From bf89f09238fbdd61d2b50dbcd8985bce715fbe75 Mon Sep 17 00:00:00 2001 From: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> Date: Thu, 2 Mar 2023 19:35:08 -0800 Subject: [PATCH] Removing Operator UI (#2692) Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> --- .github/workflows/jobs.yaml | 261 +- DEVELOPMENT.md | 75 +- Makefile | 32 +- cmd/console/app_commands.go | 10 - cmd/console/app_commands_noop.go | 92 - cmd/console/operator.go | 188 - docs/console_operator_mode.md | 39 - k8s/boilerplate.go.txt | 15 - k8s/create-kind.sh | 44 - k8s/kind-cluster.yaml | 22 - k8s/metrics-dev.yaml | 153 - .../base/console-cluster-role-binding.yaml | 12 - .../base/console-cluster-role.yaml | 234 - .../base/console-configmap.yaml | 7 - .../base/console-deployment.yaml | 29 - .../base/console-service-account.yaml | 5 - .../base/console-service.yaml | 14 - k8s/operator-console/base/kustomization.yaml | 10 - .../standalone/console-deployment.yaml | 46 - k8s/tools.go | 20 - k8s/update-codegen.sh | 35 - models/allocatable_resources_response.go | 173 - models/annotation.go | 70 - models/aws_configuration.go | 329 - models/azure_configuration.go | 321 - models/certificate_info.go | 76 - models/check_operator_version_response.go | 70 - models/condition.go | 70 - models/config_map.go | 70 - models/configure_tenant_request.go | 67 - models/container.go | 309 - models/create_tenant_request.go | 593 - models/create_tenant_response.go | 136 - models/csr_element.go | 154 - models/csr_elements.go | 133 - models/delete_tenant_request.go | 67 - models/describe_p_v_c_wrapper.go | 217 - models/describe_pod_wrapper.go | 517 - models/direct_p_v_drive_info.go | 85 - models/direct_p_v_volume_info.go | 76 - models/domains_configuration.go | 70 - models/encryption_configuration.go | 705 - models/encryption_configuration_response.go | 787 -- models/environment_variable.go | 70 - models/event_list_element.go | 82 - models/event_list_wrapper.go | 90 - models/format_configuration.go | 105 - models/format_direct_p_v_drives_response.go | 133 - models/gcp_configuration.go | 280 - models/gemalto_configuration.go | 309 - models/gemalto_configuration_response.go | 309 - models/get_direct_p_v_drive_list_response.go | 133 - models/get_direct_p_v_volume_list_response.go | 133 - models/idp_configuration.go | 512 - models/image_registry.go | 122 - models/key_pair_configuration.go | 105 - models/label.go | 70 - models/list_p_v_cs_response.go | 133 - models/list_tenants_response.go | 136 - models/log_search_configuration.go | 182 - models/login_operator_request.go | 88 - models/max_allocatable_mem_response.go | 67 - models/metadata_fields.go | 73 - models/mount.go | 76 - models/mp_integration.go | 70 - models/namespace.go | 88 - models/node_labels.go | 44 - models/node_max_allocatable_resources.go | 70 - models/node_selector.go | 70 - models/node_selector_term.go | 343 - models/operator_session_response.go | 131 - models/operator_subnet_api_key.go | 67 - models/operator_subnet_login_m_f_a_request.go | 122 - models/operator_subnet_login_request.go | 70 - models/operator_subnet_login_response.go | 70 - ...erator_subnet_register_api_key_response.go | 67 - models/parity_response.go | 44 - models/pod_affinity_term.go | 323 - models/pool.go | 412 - models/pool_affinity.go | 1108 -- models/pool_resources.go | 70 - models/pool_toleration_seconds.go | 88 - models/pool_tolerations.go | 192 - models/pool_update_request.go | 136 - models/projected_volume.go | 133 - models/projected_volume_source.go | 216 - models/prometheus_configuration.go | 136 - models/pv_format_error_response.go | 73 - models/pvc.go | 70 - models/pvcs_list_response.go | 88 - models/resource_quota.go | 136 - models/resource_quota_element.go | 73 - models/secret.go | 70 - models/security_context.go | 128 - models/service_account_token.go | 67 - models/set_administrators_request.go | 70 - models/state.go | 85 - models/subscription_validate_request.go | 73 - models/tenant.go | 399 - models/tenant_configuration_response.go | 133 - models/tenant_list.go | 221 - models/tenant_logs.go | 543 - models/tenant_monitoring_info.go | 323 - models/tenant_pod.go | 103 - models/tenant_response_item.go | 73 - models/tenant_security_response.go | 386 - models/tenant_status.go | 182 - models/tenant_tier_element.go | 73 - models/tenant_usage.go | 70 - models/tenant_y_a_m_l.go | 67 - models/tls_configuration.go | 193 - models/toleration.go | 79 - models/update_domains_request.go | 121 - models/update_tenant_configuration_request.go | 136 - models/update_tenant_request.go | 148 - models/update_tenant_security_request.go | 335 - models/vault_configuration.go | 312 - models/vault_configuration_response.go | 312 - models/volume.go | 170 - operator-integration/tenant_test.go | 1307 -- operatorapi/auth/operator.go | 91 - operatorapi/auth/operator_test.go | 102 - operatorapi/config.go | 77 - operatorapi/config_test.go | 136 - operatorapi/configure_operator.go | 177 - operatorapi/consts.go | 36 - operatorapi/directpv.go | 328 - operatorapi/directpv_client.go | 73 - operatorapi/directpv_test.go | 410 - operatorapi/doc.go | 35 - operatorapi/embedded_spec.go | 11109 ---------------- operatorapi/k8s_client.go | 114 - operatorapi/k8s_client_mock.go | 103 - operatorapi/login.go | 243 - operatorapi/logout.go | 42 - operatorapi/logs.go | 78 - operatorapi/logs_test.go | 110 - operatorapi/marketplace.go | 196 - operatorapi/marketplace_test.go | 194 - operatorapi/minio_operator_mock.go | 45 - operatorapi/namespaces.go | 82 - operatorapi/namespaces_test.go | 63 - operatorapi/nodes.go | 373 - operatorapi/nodes_test.go | 366 - operatorapi/operations/auth/login_detail.go | 73 - .../auth/login_detail_parameters.go | 63 - .../operations/auth/login_detail_responses.go | 135 - .../auth/login_detail_urlbuilder.go | 104 - .../operations/auth/login_oauth2_auth.go | 73 - .../auth/login_oauth2_auth_parameters.go | 101 - .../auth/login_oauth2_auth_responses.go | 115 - .../auth/login_oauth2_auth_urlbuilder.go | 104 - operatorapi/operations/auth/login_operator.go | 73 - .../auth/login_operator_parameters.go | 101 - .../auth/login_operator_responses.go | 115 - .../auth/login_operator_urlbuilder.go | 104 - operatorapi/operations/auth/logout.go | 88 - .../operations/auth/logout_parameters.go | 63 - .../operations/auth/logout_responses.go | 115 - .../operations/auth/logout_urlbuilder.go | 104 - operatorapi/operations/auth/session_check.go | 88 - .../auth/session_check_parameters.go | 63 - .../auth/session_check_responses.go | 135 - .../auth/session_check_urlbuilder.go | 104 - operatorapi/operations/operator_api.go | 1142 -- .../operator_api/create_namespace.go | 88 - .../create_namespace_parameters.go | 101 - .../create_namespace_responses.go | 115 - .../create_namespace_urlbuilder.go | 104 - .../operations/operator_api/create_tenant.go | 88 - .../operator_api/create_tenant_parameters.go | 101 - .../operator_api/create_tenant_responses.go | 135 - .../operator_api/create_tenant_urlbuilder.go | 104 - .../operations/operator_api/delete_p_v_c.go | 88 - .../operator_api/delete_p_v_c_parameters.go | 136 - .../operator_api/delete_p_v_c_responses.go | 115 - .../operator_api/delete_p_v_c_urlbuilder.go | 132 - .../operations/operator_api/delete_pod.go | 88 - .../operator_api/delete_pod_parameters.go | 136 - .../operator_api/delete_pod_responses.go | 115 - .../operator_api/delete_pod_urlbuilder.go | 132 - .../operations/operator_api/delete_tenant.go | 88 - .../operator_api/delete_tenant_parameters.go | 142 - .../operator_api/delete_tenant_responses.go | 115 - .../operator_api/delete_tenant_urlbuilder.go | 124 - .../operations/operator_api/describe_pod.go | 88 - .../operator_api/describe_pod_parameters.go | 136 - .../operator_api/describe_pod_responses.go | 135 - .../operator_api/describe_pod_urlbuilder.go | 132 - .../operator_api/direct_p_v_format_drive.go | 88 - .../direct_p_v_format_drive_parameters.go | 101 - .../direct_p_v_format_drive_responses.go | 135 - .../direct_p_v_format_drive_urlbuilder.go | 104 - .../operator_api/disable_tenant_logging.go | 88 - .../disable_tenant_logging_parameters.go | 112 - .../disable_tenant_logging_responses.go | 133 - .../disable_tenant_logging_urlbuilder.go | 124 - .../operator_api/enable_tenant_logging.go | 88 - .../enable_tenant_logging_parameters.go | 112 - .../enable_tenant_logging_responses.go | 133 - .../enable_tenant_logging_urlbuilder.go | 124 - .../operator_api/get_allocatable_resources.go | 88 - .../get_allocatable_resources_parameters.go | 120 - .../get_allocatable_resources_responses.go | 135 - .../get_allocatable_resources_urlbuilder.go | 119 - .../operator_api/get_direct_p_v_drive_list.go | 88 - .../get_direct_p_v_drive_list_parameters.go | 121 - .../get_direct_p_v_drive_list_responses.go | 135 - .../get_direct_p_v_drive_list_urlbuilder.go | 129 - .../get_direct_p_v_volume_list.go | 88 - .../get_direct_p_v_volume_list_parameters.go | 121 - .../get_direct_p_v_volume_list_responses.go | 135 - .../get_direct_p_v_volume_list_urlbuilder.go | 129 - .../operator_api/get_m_p_integration.go | 128 - .../get_m_p_integration_parameters.go | 63 - .../get_m_p_integration_responses.go | 135 - .../get_m_p_integration_urlbuilder.go | 104 - .../operator_api/get_max_allocatable_mem.go | 88 - .../get_max_allocatable_mem_parameters.go | 120 - .../get_max_allocatable_mem_responses.go | 135 - .../get_max_allocatable_mem_urlbuilder.go | 119 - .../operator_api/get_p_v_c_describe.go | 88 - .../get_p_v_c_describe_parameters.go | 136 - .../get_p_v_c_describe_responses.go | 135 - .../get_p_v_c_describe_urlbuilder.go | 132 - .../operator_api/get_p_v_c_events.go | 88 - .../get_p_v_c_events_parameters.go | 136 - .../get_p_v_c_events_responses.go | 138 - .../get_p_v_c_events_urlbuilder.go | 132 - .../operations/operator_api/get_parity.go | 88 - .../operator_api/get_parity_parameters.go | 154 - .../operator_api/get_parity_responses.go | 138 - .../operator_api/get_parity_urlbuilder.go | 126 - .../operations/operator_api/get_pod_events.go | 88 - .../operator_api/get_pod_events_parameters.go | 136 - .../operator_api/get_pod_events_responses.go | 138 - .../operator_api/get_pod_events_urlbuilder.go | 132 - .../operations/operator_api/get_pod_logs.go | 88 - .../operator_api/get_pod_logs_parameters.go | 136 - .../operator_api/get_pod_logs_responses.go | 133 - .../operator_api/get_pod_logs_urlbuilder.go | 132 - .../operator_api/get_resource_quota.go | 88 - .../get_resource_quota_parameters.go | 112 - .../get_resource_quota_responses.go | 135 - .../get_resource_quota_urlbuilder.go | 124 - .../operator_api/get_tenant_events.go | 88 - .../get_tenant_events_parameters.go | 112 - .../get_tenant_events_responses.go | 138 - .../get_tenant_events_urlbuilder.go | 124 - .../operator_api/get_tenant_logs.go | 88 - .../get_tenant_logs_parameters.go | 112 - .../operator_api/get_tenant_logs_responses.go | 135 - .../get_tenant_logs_urlbuilder.go | 124 - .../operator_api/get_tenant_monitoring.go | 88 - .../get_tenant_monitoring_parameters.go | 112 - .../get_tenant_monitoring_responses.go | 135 - .../get_tenant_monitoring_urlbuilder.go | 124 - .../operator_api/get_tenant_pods.go | 88 - .../get_tenant_pods_parameters.go | 112 - .../operator_api/get_tenant_pods_responses.go | 138 - .../get_tenant_pods_urlbuilder.go | 124 - .../operator_api/get_tenant_usage.go | 88 - .../get_tenant_usage_parameters.go | 112 - .../get_tenant_usage_responses.go | 135 - .../get_tenant_usage_urlbuilder.go | 124 - .../operator_api/get_tenant_y_a_m_l.go | 88 - .../get_tenant_y_a_m_l_parameters.go | 112 - .../get_tenant_y_a_m_l_responses.go | 135 - .../get_tenant_y_a_m_l_urlbuilder.go | 124 - .../operator_api/list_all_tenants.go | 88 - .../list_all_tenants_parameters.go | 159 - .../list_all_tenants_responses.go | 135 - .../list_all_tenants_urlbuilder.go | 140 - .../operator_api/list_node_labels.go | 88 - .../list_node_labels_parameters.go | 63 - .../list_node_labels_responses.go | 138 - .../list_node_labels_urlbuilder.go | 104 - .../operations/operator_api/list_p_v_cs.go | 88 - .../operator_api/list_p_v_cs_for_tenant.go | 88 - .../list_p_v_cs_for_tenant_parameters.go | 112 - .../list_p_v_cs_for_tenant_responses.go | 135 - .../list_p_v_cs_for_tenant_urlbuilder.go | 124 - .../operator_api/list_p_v_cs_parameters.go | 63 - .../operator_api/list_p_v_cs_responses.go | 135 - .../operator_api/list_p_v_cs_urlbuilder.go | 104 - ...list_tenant_certificate_signing_request.go | 88 - ..._certificate_signing_request_parameters.go | 112 - ...t_certificate_signing_request_responses.go | 135 - ..._certificate_signing_request_urlbuilder.go | 124 - .../operations/operator_api/list_tenants.go | 88 - .../operator_api/list_tenants_parameters.go | 183 - .../operator_api/list_tenants_responses.go | 135 - .../operator_api/list_tenants_urlbuilder.go | 150 - .../operator_api/operator_subnet_api_key.go | 88 - .../operator_subnet_api_key_info.go | 88 - ...operator_subnet_api_key_info_parameters.go | 63 - .../operator_subnet_api_key_info_responses.go | 135 - ...operator_subnet_api_key_info_urlbuilder.go | 104 - .../operator_subnet_api_key_parameters.go | 99 - .../operator_subnet_api_key_responses.go | 135 - .../operator_subnet_api_key_urlbuilder.go | 117 - .../operator_api/operator_subnet_login.go | 88 - .../operator_subnet_login_m_f_a.go | 88 - .../operator_subnet_login_m_f_a_parameters.go | 101 - .../operator_subnet_login_m_f_a_responses.go | 135 - .../operator_subnet_login_m_f_a_urlbuilder.go | 104 - .../operator_subnet_login_parameters.go | 101 - .../operator_subnet_login_responses.go | 135 - .../operator_subnet_login_urlbuilder.go | 104 - .../operator_subnet_register_api_key.go | 88 - ...ator_subnet_register_api_key_parameters.go | 101 - ...rator_subnet_register_api_key_responses.go | 135 - ...ator_subnet_register_api_key_urlbuilder.go | 104 - .../operator_api/post_m_p_integration.go | 88 - .../post_m_p_integration_parameters.go | 101 - .../post_m_p_integration_responses.go | 115 - .../post_m_p_integration_urlbuilder.go | 104 - .../operator_api/put_tenant_y_a_m_l.go | 88 - .../put_tenant_y_a_m_l_parameters.go | 150 - .../put_tenant_y_a_m_l_responses.go | 115 - .../put_tenant_y_a_m_l_urlbuilder.go | 124 - .../operator_api/set_tenant_administrators.go | 88 - .../set_tenant_administrators_parameters.go | 150 - .../set_tenant_administrators_responses.go | 115 - .../set_tenant_administrators_urlbuilder.go | 124 - .../operator_api/set_tenant_logs.go | 88 - .../set_tenant_logs_parameters.go | 150 - .../operator_api/set_tenant_logs_responses.go | 133 - .../set_tenant_logs_urlbuilder.go | 124 - .../operator_api/set_tenant_monitoring.go | 88 - .../set_tenant_monitoring_parameters.go | 150 - .../set_tenant_monitoring_responses.go | 115 - .../set_tenant_monitoring_urlbuilder.go | 124 - .../operator_api/subscription_activate.go | 88 - .../subscription_activate_parameters.go | 112 - .../subscription_activate_responses.go | 115 - .../subscription_activate_urlbuilder.go | 124 - .../operator_api/subscription_info.go | 88 - .../subscription_info_parameters.go | 63 - .../subscription_info_responses.go | 135 - .../subscription_info_urlbuilder.go | 104 - .../operator_api/subscription_refresh.go | 88 - .../subscription_refresh_parameters.go | 63 - .../subscription_refresh_responses.go | 135 - .../subscription_refresh_urlbuilder.go | 104 - .../operator_api/subscription_validate.go | 88 - .../subscription_validate_parameters.go | 101 - .../subscription_validate_responses.go | 135 - .../subscription_validate_urlbuilder.go | 104 - .../operator_api/tenant_add_pool.go | 88 - .../tenant_add_pool_parameters.go | 150 - .../operator_api/tenant_add_pool_responses.go | 115 - .../tenant_add_pool_urlbuilder.go | 124 - .../operator_api/tenant_configuration.go | 88 - .../tenant_configuration_parameters.go | 112 - .../tenant_configuration_responses.go | 135 - .../tenant_configuration_urlbuilder.go | 124 - .../operator_api/tenant_delete_encryption.go | 88 - .../tenant_delete_encryption_parameters.go | 112 - .../tenant_delete_encryption_responses.go | 115 - .../tenant_delete_encryption_urlbuilder.go | 124 - .../operations/operator_api/tenant_details.go | 88 - .../operator_api/tenant_details_parameters.go | 112 - .../operator_api/tenant_details_responses.go | 135 - .../operator_api/tenant_details_urlbuilder.go | 124 - .../operator_api/tenant_encryption_info.go | 88 - .../tenant_encryption_info_parameters.go | 112 - .../tenant_encryption_info_responses.go | 135 - .../tenant_encryption_info_urlbuilder.go | 124 - .../operator_api/tenant_identity_provider.go | 88 - .../tenant_identity_provider_parameters.go | 112 - .../tenant_identity_provider_responses.go | 135 - .../tenant_identity_provider_urlbuilder.go | 124 - .../operator_api/tenant_security.go | 88 - .../tenant_security_parameters.go | 112 - .../operator_api/tenant_security_responses.go | 135 - .../tenant_security_urlbuilder.go | 124 - .../operator_api/tenant_update_certificate.go | 88 - .../tenant_update_certificate_parameters.go | 150 - .../tenant_update_certificate_responses.go | 115 - .../tenant_update_certificate_urlbuilder.go | 124 - .../operator_api/tenant_update_encryption.go | 88 - .../tenant_update_encryption_parameters.go | 150 - .../tenant_update_encryption_responses.go | 115 - .../tenant_update_encryption_urlbuilder.go | 124 - .../operator_api/tenant_update_pools.go | 88 - .../tenant_update_pools_parameters.go | 150 - .../tenant_update_pools_responses.go | 135 - .../tenant_update_pools_urlbuilder.go | 124 - .../operations/operator_api/update_tenant.go | 88 - .../update_tenant_configuration.go | 88 - .../update_tenant_configuration_parameters.go | 150 - .../update_tenant_configuration_responses.go | 115 - .../update_tenant_configuration_urlbuilder.go | 124 - .../operator_api/update_tenant_domains.go | 88 - .../update_tenant_domains_parameters.go | 150 - .../update_tenant_domains_responses.go | 115 - .../update_tenant_domains_urlbuilder.go | 124 - .../update_tenant_identity_provider.go | 88 - ...ate_tenant_identity_provider_parameters.go | 150 - ...date_tenant_identity_provider_responses.go | 115 - ...ate_tenant_identity_provider_urlbuilder.go | 124 - .../operator_api/update_tenant_parameters.go | 150 - .../operator_api/update_tenant_responses.go | 115 - .../operator_api/update_tenant_security.go | 88 - .../update_tenant_security_parameters.go | 150 - .../update_tenant_security_responses.go | 115 - .../update_tenant_security_urlbuilder.go | 124 - .../operator_api/update_tenant_urlbuilder.go | 124 - .../user_api/check_min_i_o_version.go | 73 - .../check_min_i_o_version_parameters.go | 63 - .../check_min_i_o_version_responses.go | 135 - .../check_min_i_o_version_urlbuilder.go | 104 - operatorapi/operator_client.go | 70 - operatorapi/operator_subnet.go | 203 - operatorapi/operator_subnet_test.go | 304 - operatorapi/parity.go | 63 - operatorapi/parity_test.go | 131 - operatorapi/proxy.go | 341 - operatorapi/resource_quota.go | 112 - operatorapi/resource_quota_test.go | 132 - operatorapi/server.go | 524 - operatorapi/session.go | 70 - operatorapi/tenant_add.go | 659 - operatorapi/tenant_get.go | 158 - operatorapi/tenant_logs_handlers.go | 467 - operatorapi/tenant_logs_handlers_test.go | 331 - operatorapi/tenant_update.go | 105 - operatorapi/tenants.go | 2810 ---- operatorapi/tenants_2_test.go | 2026 --- operatorapi/tenants_helper.go | 901 -- operatorapi/tenants_helper_test.go | 375 - operatorapi/tenants_test.go | 1845 --- operatorapi/utils.go | 74 - operatorapi/utils_test.go | 254 - operatorapi/version.go | 60 - operatorapi/volumes.go | 344 - operatorapi/volumes_test.go | 81 - portal-ui/src/ProtectedRoutes.tsx | 13 +- .../__tests__/accessControl.test.ts | 4 - .../src/common/SecureComponent/permissions.ts | 47 - portal-ui/src/common/types.ts | 416 - portal-ui/src/common/utils.ts | 233 +- .../Account/AddServiceAccountScreen.tsx | 2 +- portal-ui/src/screens/Console/CommandBar.tsx | 7 +- .../Common/TLSCertificate/TLSCertificate.tsx | 211 - .../TolerationSelector/TolerationSelector.tsx | 222 - .../Common/UsageBarWrapper/StackRow.tsx | 23 - .../UsageBarWrapper/SummaryUsageBar.tsx | 189 - portal-ui/src/screens/Console/Console.tsx | 103 +- .../Console/DirectPV/DirectPVDrives.tsx | 346 - .../Console/DirectPV/DirectPVVolumes.tsx | 163 - .../screens/Console/DirectPV/FormatDrives.tsx | 143 - .../Console/DirectPV/FormatErrorsResult.tsx | 116 - .../screens/Console/DirectPV/directPVSlice.ts | 40 - .../src/screens/Console/DirectPV/types.ts | 50 - .../src/screens/Console/License/License.tsx | 4 - .../screens/Console/License/LicenseLink.tsx | 8 +- .../screens/Console/License/LicensePlans.tsx | 10 +- .../Console/Marketplace/Marketplace.tsx | 82 - .../Console/Marketplace/SetEmailModal.tsx | 123 - .../Console/Marketplace/euTimezones.ts | 78 - .../src/screens/Console/Marketplace/types.tsx | 27 - portal-ui/src/screens/Console/Menu/Menu.tsx | 12 +- .../src/screens/Console/Menu/MenuToggle.tsx | 29 +- .../screens/Console/Storage/StoragePVCs.tsx | 167 - .../src/screens/Console/Storage/types.ts | 31 - .../Console/Support/OnlineRegistration.tsx | 7 +- .../Console/Tenants/AddTenant/AddTenant.tsx | 228 - .../Tenants/AddTenant/CreateTenantButton.tsx | 60 - .../AddTenant/NewTenantCredentials.tsx | 52 - .../Tenants/AddTenant/Steps/Affinity.tsx | 519 - .../AddTenant/Steps/ConfigLogSearch.tsx | 614 - .../AddTenant/Steps/ConfigPrometheus.tsx | 452 - .../Tenants/AddTenant/Steps/Configure.tsx | 709 - .../Tenants/AddTenant/Steps/Encryption.tsx | 733 - .../AddTenant/Steps/Encryption/AWSKMSAdd.tsx | 226 - .../Steps/Encryption/AzureKMSAdd.tsx | 195 - .../AddTenant/Steps/Encryption/GCPKMSAdd.tsx | 152 - .../Steps/Encryption/GemaltoKMSAdd.tsx | 208 - .../Steps/Encryption/VaultKMSAdd.tsx | 296 - .../AddTenant/Steps/IdentityProvider.tsx | 104 - .../IdentityProvider/IDPActiveDirectory.tsx | 466 - .../Steps/IdentityProvider/IDPBuiltIn.tsx | 239 - .../Steps/IdentityProvider/IDPOpenID.tsx | 253 - .../Tenants/AddTenant/Steps/Images.tsx | 507 - .../Tenants/AddTenant/Steps/Security.tsx | 452 - .../Tenants/AddTenant/Steps/SizePreview.tsx | 237 - .../Steps/TenantResources/NameTenantMain.tsx | 211 - .../TenantResources/NamespaceSelector.tsx | 86 - .../Steps/TenantResources/TenantResources.tsx | 55 - .../Steps/TenantResources/TenantSize.tsx | 418 - .../Steps/TenantResources/TenantSizeMK.tsx | 360 - .../TenantResources/TenantSizeResources.tsx | 404 - .../AddTenant/Steps/TenantResources/utils.tsx | 167 - .../Steps/helpers/AddNamespaceModal.tsx | 89 - .../Console/Tenants/AddTenant/common.ts | 24 - .../Tenants/AddTenant/createTenantAPI.ts | 61 - .../Tenants/AddTenant/createTenantSlice.ts | 1003 -- .../Console/Tenants/AddTenant/sliceUtils.ts | 36 - .../AddTenant/thunks/createTenantThunk.ts | 599 - .../AddTenant/thunks/namespaceThunks.ts | 102 - .../Console/Tenants/HelpBox/TLSHelpBox.tsx | 143 - .../Tenants/ListTenants/DeleteTenant.tsx | 123 - .../Tenants/ListTenants/InformationItem.tsx | 69 - .../Tenants/ListTenants/ListTenants.tsx | 362 - .../Tenants/ListTenants/TenantCapacity.tsx | 192 - .../Tenants/ListTenants/TenantListItem.tsx | 345 - .../Console/Tenants/ListTenants/types.ts | 286 - .../Console/Tenants/ListTenants/utils.ts | 102 - .../Console/Tenants/LogoComponents.tsx | 51 - .../Tenants/TenantDetails/DeletePVC.tsx | 99 - .../Tenants/TenantDetails/DeletePod.tsx | 97 - .../Tenants/TenantDetails/EditDomains.tsx | 313 - .../EditTenantMonitoringScreen.tsx | 580 - .../Tenants/TenantDetails/KeyPairEdit.tsx | 152 - .../TenantDetails/LoggingDBDetails.tsx | 354 - .../Tenants/TenantDetails/LoggingDetails.tsx | 393 - .../Tenants/TenantDetails/PodsSummary.tsx | 189 - .../TenantDetails/Pools/AddPool/AddPool.tsx | 168 - .../Pools/AddPool/AddPoolCreateButton.tsx | 51 - .../Pools/AddPool/PoolConfiguration.tsx | 336 - .../Pools/AddPool/PoolPodPlacement.tsx | 519 - .../Pools/AddPool/PoolResources.tsx | 306 - .../Pools/AddPool/addPoolSlice.ts | 198 - .../Pools/AddPool/addPoolThunks.ts | 118 - .../Pools/Details/PoolDetails.tsx | 264 - .../Pools/Details/PoolsListing.tsx | 147 - .../TenantDetails/Pools/EditPool/EditPool.tsx | 192 - .../Pools/EditPool/EditPoolButton.tsx | 58 - .../Pools/EditPool/EditPoolConfiguration.tsx | 335 - .../Pools/EditPool/EditPoolPlacement.tsx | 518 - .../Pools/EditPool/EditPoolResources.tsx | 288 - .../Pools/EditPool/editPoolSlice.ts | 288 - .../Pools/EditPool/thunks/editPoolAsync.ts | 151 - .../TenantDetails/Pools/EditPool/types.ts | 54 - .../Tenants/TenantDetails/PoolsSummary.tsx | 95 - .../TenantDetails/SubnetLicenseTenant.tsx | 264 - .../TenantDetails/TenantAuditLogsScreen.tsx | 365 - .../Tenants/TenantDetails/TenantCSR.tsx | 142 - .../TenantDetails/TenantConfiguration.tsx | 317 - .../Tenants/TenantDetails/TenantDetails.tsx | 517 - .../TenantDetails/TenantEncryption.tsx | 1736 --- .../Tenants/TenantDetails/TenantEvents.tsx | 106 - .../TenantDetails/TenantIdentityProvider.tsx | 814 -- .../Tenants/TenantDetails/TenantLicense.tsx | 126 - .../Tenants/TenantDetails/TenantMetrics.tsx | 72 - .../Tenants/TenantDetails/TenantSecurity.tsx | 850 -- .../Tenants/TenantDetails/TenantSummary.tsx | 478 - .../Tenants/TenantDetails/TenantTrace.tsx | 72 - .../Tenants/TenantDetails/TenantYAML.tsx | 182 - .../TenantDetails/UpdateTenantModal.tsx | 250 - .../Tenants/TenantDetails/VolumesSummary.tsx | 190 - .../TenantDetails/events/EventsList.tsx | 108 - .../Console/Tenants/TenantDetails/hop/Hop.tsx | 165 - .../TenantDetails/pods/PodDescribe.tsx | 473 - .../Tenants/TenantDetails/pods/PodDetails.tsx | 125 - .../Tenants/TenantDetails/pods/PodEvents.tsx | 92 - .../Tenants/TenantDetails/pods/PodLogs.tsx | 251 - .../TenantDetails/pvcs/PVCDescribe.tsx | 217 - .../TenantDetails/pvcs/TenantVolumes.tsx | 130 - .../Tenants/TenantDetails/pvcs/pvcTypes.ts | 58 - .../TenantDetails/tenantAuditLogSlice.ts | 201 - .../TenantDetails/tenantMonitoringSlice.ts | 131 - .../Console/Tenants/TenantDetails/utils.ts | 82 - .../Tenants/securityContextSelector.tsx | 163 - .../Tenants/tenantSecurityContextSlice.ts | 65 - .../screens/Console/Tenants/tenantsSlice.ts | 108 - .../Tenants/thunks/tenantDetailsAsync.ts | 70 - .../src/screens/Console/Tenants/types.ts | 376 - .../src/screens/Console/Tenants/utils.ts | 41 - .../Users/AddUserServiceAccountScreen.tsx | 8 +- portal-ui/src/screens/Console/consoleSlice.ts | 1 - .../src/screens/Console/kbar-actions.tsx | 50 +- portal-ui/src/screens/Console/types.ts | 2 - portal-ui/src/screens/Console/valid-routes.ts | 140 +- portal-ui/src/store.ts | 17 - portal-ui/src/systemSlice.ts | 16 - portal-ui/src/types.ts | 120 - portal-ui/tests/operator/login/login.ts | 27 - .../operator/tenant/test-1/tenant-test-1.ts | 499 - .../operator/tenant/test-2/tenant-test-2.ts | 469 - portal-ui/tests/operator/utils.ts | 131 - swagger-operator.yml | 3755 ------ swagger-console.yml => swagger.yml | 0 tests/common.sh | 150 - tests/console-sa-secret.yaml | 8 - tests/deploy-tenant.sh | 72 - 588 files changed, 143 insertions(+), 114607 deletions(-) delete mode 100644 cmd/console/app_commands_noop.go delete mode 100644 cmd/console/operator.go delete mode 100644 docs/console_operator_mode.md delete mode 100644 k8s/boilerplate.go.txt delete mode 100755 k8s/create-kind.sh delete mode 100644 k8s/kind-cluster.yaml delete mode 100644 k8s/metrics-dev.yaml delete mode 100644 k8s/operator-console/base/console-cluster-role-binding.yaml delete mode 100644 k8s/operator-console/base/console-cluster-role.yaml delete mode 100644 k8s/operator-console/base/console-configmap.yaml delete mode 100644 k8s/operator-console/base/console-deployment.yaml delete mode 100644 k8s/operator-console/base/console-service-account.yaml delete mode 100644 k8s/operator-console/base/console-service.yaml delete mode 100644 k8s/operator-console/base/kustomization.yaml delete mode 100644 k8s/operator-console/standalone/console-deployment.yaml delete mode 100644 k8s/tools.go delete mode 100755 k8s/update-codegen.sh delete mode 100644 models/allocatable_resources_response.go delete mode 100644 models/annotation.go delete mode 100644 models/aws_configuration.go delete mode 100644 models/azure_configuration.go delete mode 100644 models/certificate_info.go delete mode 100644 models/check_operator_version_response.go delete mode 100644 models/condition.go delete mode 100644 models/config_map.go delete mode 100644 models/configure_tenant_request.go delete mode 100644 models/container.go delete mode 100644 models/create_tenant_request.go delete mode 100644 models/create_tenant_response.go delete mode 100644 models/csr_element.go delete mode 100644 models/csr_elements.go delete mode 100644 models/delete_tenant_request.go delete mode 100644 models/describe_p_v_c_wrapper.go delete mode 100644 models/describe_pod_wrapper.go delete mode 100644 models/direct_p_v_drive_info.go delete mode 100644 models/direct_p_v_volume_info.go delete mode 100644 models/domains_configuration.go delete mode 100644 models/encryption_configuration.go delete mode 100644 models/encryption_configuration_response.go delete mode 100644 models/environment_variable.go delete mode 100644 models/event_list_element.go delete mode 100644 models/event_list_wrapper.go delete mode 100644 models/format_configuration.go delete mode 100644 models/format_direct_p_v_drives_response.go delete mode 100644 models/gcp_configuration.go delete mode 100644 models/gemalto_configuration.go delete mode 100644 models/gemalto_configuration_response.go delete mode 100644 models/get_direct_p_v_drive_list_response.go delete mode 100644 models/get_direct_p_v_volume_list_response.go delete mode 100644 models/idp_configuration.go delete mode 100644 models/image_registry.go delete mode 100644 models/key_pair_configuration.go delete mode 100644 models/label.go delete mode 100644 models/list_p_v_cs_response.go delete mode 100644 models/list_tenants_response.go delete mode 100644 models/log_search_configuration.go delete mode 100644 models/login_operator_request.go delete mode 100644 models/max_allocatable_mem_response.go delete mode 100644 models/metadata_fields.go delete mode 100644 models/mount.go delete mode 100644 models/mp_integration.go delete mode 100644 models/namespace.go delete mode 100644 models/node_labels.go delete mode 100644 models/node_max_allocatable_resources.go delete mode 100644 models/node_selector.go delete mode 100644 models/node_selector_term.go delete mode 100644 models/operator_session_response.go delete mode 100644 models/operator_subnet_api_key.go delete mode 100644 models/operator_subnet_login_m_f_a_request.go delete mode 100644 models/operator_subnet_login_request.go delete mode 100644 models/operator_subnet_login_response.go delete mode 100644 models/operator_subnet_register_api_key_response.go delete mode 100644 models/parity_response.go delete mode 100644 models/pod_affinity_term.go delete mode 100644 models/pool.go delete mode 100644 models/pool_affinity.go delete mode 100644 models/pool_resources.go delete mode 100644 models/pool_toleration_seconds.go delete mode 100644 models/pool_tolerations.go delete mode 100644 models/pool_update_request.go delete mode 100644 models/projected_volume.go delete mode 100644 models/projected_volume_source.go delete mode 100644 models/prometheus_configuration.go delete mode 100644 models/pv_format_error_response.go delete mode 100644 models/pvc.go delete mode 100644 models/pvcs_list_response.go delete mode 100644 models/resource_quota.go delete mode 100644 models/resource_quota_element.go delete mode 100644 models/secret.go delete mode 100644 models/security_context.go delete mode 100644 models/service_account_token.go delete mode 100644 models/set_administrators_request.go delete mode 100644 models/state.go delete mode 100644 models/subscription_validate_request.go delete mode 100644 models/tenant.go delete mode 100644 models/tenant_configuration_response.go delete mode 100644 models/tenant_list.go delete mode 100644 models/tenant_logs.go delete mode 100644 models/tenant_monitoring_info.go delete mode 100644 models/tenant_pod.go delete mode 100644 models/tenant_response_item.go delete mode 100644 models/tenant_security_response.go delete mode 100644 models/tenant_status.go delete mode 100644 models/tenant_tier_element.go delete mode 100644 models/tenant_usage.go delete mode 100644 models/tenant_y_a_m_l.go delete mode 100644 models/tls_configuration.go delete mode 100644 models/toleration.go delete mode 100644 models/update_domains_request.go delete mode 100644 models/update_tenant_configuration_request.go delete mode 100644 models/update_tenant_request.go delete mode 100644 models/update_tenant_security_request.go delete mode 100644 models/vault_configuration.go delete mode 100644 models/vault_configuration_response.go delete mode 100644 models/volume.go delete mode 100644 operator-integration/tenant_test.go delete mode 100644 operatorapi/auth/operator.go delete mode 100644 operatorapi/auth/operator_test.go delete mode 100644 operatorapi/config.go delete mode 100644 operatorapi/config_test.go delete mode 100644 operatorapi/configure_operator.go delete mode 100644 operatorapi/consts.go delete mode 100644 operatorapi/directpv.go delete mode 100644 operatorapi/directpv_client.go delete mode 100644 operatorapi/directpv_test.go delete mode 100644 operatorapi/doc.go delete mode 100644 operatorapi/embedded_spec.go delete mode 100644 operatorapi/k8s_client.go delete mode 100644 operatorapi/k8s_client_mock.go delete mode 100644 operatorapi/login.go delete mode 100644 operatorapi/logout.go delete mode 100644 operatorapi/logs.go delete mode 100644 operatorapi/logs_test.go delete mode 100644 operatorapi/marketplace.go delete mode 100644 operatorapi/marketplace_test.go delete mode 100644 operatorapi/minio_operator_mock.go delete mode 100644 operatorapi/namespaces.go delete mode 100644 operatorapi/namespaces_test.go delete mode 100644 operatorapi/nodes.go delete mode 100644 operatorapi/nodes_test.go delete mode 100644 operatorapi/operations/auth/login_detail.go delete mode 100644 operatorapi/operations/auth/login_detail_parameters.go delete mode 100644 operatorapi/operations/auth/login_detail_responses.go delete mode 100644 operatorapi/operations/auth/login_detail_urlbuilder.go delete mode 100644 operatorapi/operations/auth/login_oauth2_auth.go delete mode 100644 operatorapi/operations/auth/login_oauth2_auth_parameters.go delete mode 100644 operatorapi/operations/auth/login_oauth2_auth_responses.go delete mode 100644 operatorapi/operations/auth/login_oauth2_auth_urlbuilder.go delete mode 100644 operatorapi/operations/auth/login_operator.go delete mode 100644 operatorapi/operations/auth/login_operator_parameters.go delete mode 100644 operatorapi/operations/auth/login_operator_responses.go delete mode 100644 operatorapi/operations/auth/login_operator_urlbuilder.go delete mode 100644 operatorapi/operations/auth/logout.go delete mode 100644 operatorapi/operations/auth/logout_parameters.go delete mode 100644 operatorapi/operations/auth/logout_responses.go delete mode 100644 operatorapi/operations/auth/logout_urlbuilder.go delete mode 100644 operatorapi/operations/auth/session_check.go delete mode 100644 operatorapi/operations/auth/session_check_parameters.go delete mode 100644 operatorapi/operations/auth/session_check_responses.go delete mode 100644 operatorapi/operations/auth/session_check_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api.go delete mode 100644 operatorapi/operations/operator_api/create_namespace.go delete mode 100644 operatorapi/operations/operator_api/create_namespace_parameters.go delete mode 100644 operatorapi/operations/operator_api/create_namespace_responses.go delete mode 100644 operatorapi/operations/operator_api/create_namespace_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/create_tenant.go delete mode 100644 operatorapi/operations/operator_api/create_tenant_parameters.go delete mode 100644 operatorapi/operations/operator_api/create_tenant_responses.go delete mode 100644 operatorapi/operations/operator_api/create_tenant_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/delete_p_v_c.go delete mode 100644 operatorapi/operations/operator_api/delete_p_v_c_parameters.go delete mode 100644 operatorapi/operations/operator_api/delete_p_v_c_responses.go delete mode 100644 operatorapi/operations/operator_api/delete_p_v_c_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/delete_pod.go delete mode 100644 operatorapi/operations/operator_api/delete_pod_parameters.go delete mode 100644 operatorapi/operations/operator_api/delete_pod_responses.go delete mode 100644 operatorapi/operations/operator_api/delete_pod_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/delete_tenant.go delete mode 100644 operatorapi/operations/operator_api/delete_tenant_parameters.go delete mode 100644 operatorapi/operations/operator_api/delete_tenant_responses.go delete mode 100644 operatorapi/operations/operator_api/delete_tenant_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/describe_pod.go delete mode 100644 operatorapi/operations/operator_api/describe_pod_parameters.go delete mode 100644 operatorapi/operations/operator_api/describe_pod_responses.go delete mode 100644 operatorapi/operations/operator_api/describe_pod_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/direct_p_v_format_drive.go delete mode 100644 operatorapi/operations/operator_api/direct_p_v_format_drive_parameters.go delete mode 100644 operatorapi/operations/operator_api/direct_p_v_format_drive_responses.go delete mode 100644 operatorapi/operations/operator_api/direct_p_v_format_drive_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/disable_tenant_logging.go delete mode 100644 operatorapi/operations/operator_api/disable_tenant_logging_parameters.go delete mode 100644 operatorapi/operations/operator_api/disable_tenant_logging_responses.go delete mode 100644 operatorapi/operations/operator_api/disable_tenant_logging_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/enable_tenant_logging.go delete mode 100644 operatorapi/operations/operator_api/enable_tenant_logging_parameters.go delete mode 100644 operatorapi/operations/operator_api/enable_tenant_logging_responses.go delete mode 100644 operatorapi/operations/operator_api/enable_tenant_logging_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/get_allocatable_resources.go delete mode 100644 operatorapi/operations/operator_api/get_allocatable_resources_parameters.go delete mode 100644 operatorapi/operations/operator_api/get_allocatable_resources_responses.go delete mode 100644 operatorapi/operations/operator_api/get_allocatable_resources_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/get_direct_p_v_drive_list.go delete mode 100644 operatorapi/operations/operator_api/get_direct_p_v_drive_list_parameters.go delete mode 100644 operatorapi/operations/operator_api/get_direct_p_v_drive_list_responses.go delete mode 100644 operatorapi/operations/operator_api/get_direct_p_v_drive_list_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/get_direct_p_v_volume_list.go delete mode 100644 operatorapi/operations/operator_api/get_direct_p_v_volume_list_parameters.go delete mode 100644 operatorapi/operations/operator_api/get_direct_p_v_volume_list_responses.go delete mode 100644 operatorapi/operations/operator_api/get_direct_p_v_volume_list_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/get_m_p_integration.go delete mode 100644 operatorapi/operations/operator_api/get_m_p_integration_parameters.go delete mode 100644 operatorapi/operations/operator_api/get_m_p_integration_responses.go delete mode 100644 operatorapi/operations/operator_api/get_m_p_integration_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/get_max_allocatable_mem.go delete mode 100644 operatorapi/operations/operator_api/get_max_allocatable_mem_parameters.go delete mode 100644 operatorapi/operations/operator_api/get_max_allocatable_mem_responses.go delete mode 100644 operatorapi/operations/operator_api/get_max_allocatable_mem_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/get_p_v_c_describe.go delete mode 100644 operatorapi/operations/operator_api/get_p_v_c_describe_parameters.go delete mode 100644 operatorapi/operations/operator_api/get_p_v_c_describe_responses.go delete mode 100644 operatorapi/operations/operator_api/get_p_v_c_describe_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/get_p_v_c_events.go delete mode 100644 operatorapi/operations/operator_api/get_p_v_c_events_parameters.go delete mode 100644 operatorapi/operations/operator_api/get_p_v_c_events_responses.go delete mode 100644 operatorapi/operations/operator_api/get_p_v_c_events_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/get_parity.go delete mode 100644 operatorapi/operations/operator_api/get_parity_parameters.go delete mode 100644 operatorapi/operations/operator_api/get_parity_responses.go delete mode 100644 operatorapi/operations/operator_api/get_parity_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/get_pod_events.go delete mode 100644 operatorapi/operations/operator_api/get_pod_events_parameters.go delete mode 100644 operatorapi/operations/operator_api/get_pod_events_responses.go delete mode 100644 operatorapi/operations/operator_api/get_pod_events_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/get_pod_logs.go delete mode 100644 operatorapi/operations/operator_api/get_pod_logs_parameters.go delete mode 100644 operatorapi/operations/operator_api/get_pod_logs_responses.go delete mode 100644 operatorapi/operations/operator_api/get_pod_logs_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/get_resource_quota.go delete mode 100644 operatorapi/operations/operator_api/get_resource_quota_parameters.go delete mode 100644 operatorapi/operations/operator_api/get_resource_quota_responses.go delete mode 100644 operatorapi/operations/operator_api/get_resource_quota_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_events.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_events_parameters.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_events_responses.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_events_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_logs.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_logs_parameters.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_logs_responses.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_logs_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_monitoring.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_monitoring_parameters.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_monitoring_responses.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_monitoring_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_pods.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_pods_parameters.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_pods_responses.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_pods_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_usage.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_usage_parameters.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_usage_responses.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_usage_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_y_a_m_l.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_y_a_m_l_parameters.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_y_a_m_l_responses.go delete mode 100644 operatorapi/operations/operator_api/get_tenant_y_a_m_l_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/list_all_tenants.go delete mode 100644 operatorapi/operations/operator_api/list_all_tenants_parameters.go delete mode 100644 operatorapi/operations/operator_api/list_all_tenants_responses.go delete mode 100644 operatorapi/operations/operator_api/list_all_tenants_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/list_node_labels.go delete mode 100644 operatorapi/operations/operator_api/list_node_labels_parameters.go delete mode 100644 operatorapi/operations/operator_api/list_node_labels_responses.go delete mode 100644 operatorapi/operations/operator_api/list_node_labels_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/list_p_v_cs.go delete mode 100644 operatorapi/operations/operator_api/list_p_v_cs_for_tenant.go delete mode 100644 operatorapi/operations/operator_api/list_p_v_cs_for_tenant_parameters.go delete mode 100644 operatorapi/operations/operator_api/list_p_v_cs_for_tenant_responses.go delete mode 100644 operatorapi/operations/operator_api/list_p_v_cs_for_tenant_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/list_p_v_cs_parameters.go delete mode 100644 operatorapi/operations/operator_api/list_p_v_cs_responses.go delete mode 100644 operatorapi/operations/operator_api/list_p_v_cs_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/list_tenant_certificate_signing_request.go delete mode 100644 operatorapi/operations/operator_api/list_tenant_certificate_signing_request_parameters.go delete mode 100644 operatorapi/operations/operator_api/list_tenant_certificate_signing_request_responses.go delete mode 100644 operatorapi/operations/operator_api/list_tenant_certificate_signing_request_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/list_tenants.go delete mode 100644 operatorapi/operations/operator_api/list_tenants_parameters.go delete mode 100644 operatorapi/operations/operator_api/list_tenants_responses.go delete mode 100644 operatorapi/operations/operator_api/list_tenants_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_api_key.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_api_key_info.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_api_key_info_parameters.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_api_key_info_responses.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_api_key_info_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_api_key_parameters.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_api_key_responses.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_api_key_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_login.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_login_m_f_a.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_login_m_f_a_parameters.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_login_m_f_a_responses.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_login_m_f_a_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_login_parameters.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_login_responses.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_login_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_register_api_key.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_register_api_key_parameters.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_register_api_key_responses.go delete mode 100644 operatorapi/operations/operator_api/operator_subnet_register_api_key_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/post_m_p_integration.go delete mode 100644 operatorapi/operations/operator_api/post_m_p_integration_parameters.go delete mode 100644 operatorapi/operations/operator_api/post_m_p_integration_responses.go delete mode 100644 operatorapi/operations/operator_api/post_m_p_integration_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/put_tenant_y_a_m_l.go delete mode 100644 operatorapi/operations/operator_api/put_tenant_y_a_m_l_parameters.go delete mode 100644 operatorapi/operations/operator_api/put_tenant_y_a_m_l_responses.go delete mode 100644 operatorapi/operations/operator_api/put_tenant_y_a_m_l_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/set_tenant_administrators.go delete mode 100644 operatorapi/operations/operator_api/set_tenant_administrators_parameters.go delete mode 100644 operatorapi/operations/operator_api/set_tenant_administrators_responses.go delete mode 100644 operatorapi/operations/operator_api/set_tenant_administrators_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/set_tenant_logs.go delete mode 100644 operatorapi/operations/operator_api/set_tenant_logs_parameters.go delete mode 100644 operatorapi/operations/operator_api/set_tenant_logs_responses.go delete mode 100644 operatorapi/operations/operator_api/set_tenant_logs_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/set_tenant_monitoring.go delete mode 100644 operatorapi/operations/operator_api/set_tenant_monitoring_parameters.go delete mode 100644 operatorapi/operations/operator_api/set_tenant_monitoring_responses.go delete mode 100644 operatorapi/operations/operator_api/set_tenant_monitoring_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/subscription_activate.go delete mode 100644 operatorapi/operations/operator_api/subscription_activate_parameters.go delete mode 100644 operatorapi/operations/operator_api/subscription_activate_responses.go delete mode 100644 operatorapi/operations/operator_api/subscription_activate_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/subscription_info.go delete mode 100644 operatorapi/operations/operator_api/subscription_info_parameters.go delete mode 100644 operatorapi/operations/operator_api/subscription_info_responses.go delete mode 100644 operatorapi/operations/operator_api/subscription_info_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/subscription_refresh.go delete mode 100644 operatorapi/operations/operator_api/subscription_refresh_parameters.go delete mode 100644 operatorapi/operations/operator_api/subscription_refresh_responses.go delete mode 100644 operatorapi/operations/operator_api/subscription_refresh_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/subscription_validate.go delete mode 100644 operatorapi/operations/operator_api/subscription_validate_parameters.go delete mode 100644 operatorapi/operations/operator_api/subscription_validate_responses.go delete mode 100644 operatorapi/operations/operator_api/subscription_validate_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/tenant_add_pool.go delete mode 100644 operatorapi/operations/operator_api/tenant_add_pool_parameters.go delete mode 100644 operatorapi/operations/operator_api/tenant_add_pool_responses.go delete mode 100644 operatorapi/operations/operator_api/tenant_add_pool_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/tenant_configuration.go delete mode 100644 operatorapi/operations/operator_api/tenant_configuration_parameters.go delete mode 100644 operatorapi/operations/operator_api/tenant_configuration_responses.go delete mode 100644 operatorapi/operations/operator_api/tenant_configuration_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/tenant_delete_encryption.go delete mode 100644 operatorapi/operations/operator_api/tenant_delete_encryption_parameters.go delete mode 100644 operatorapi/operations/operator_api/tenant_delete_encryption_responses.go delete mode 100644 operatorapi/operations/operator_api/tenant_delete_encryption_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/tenant_details.go delete mode 100644 operatorapi/operations/operator_api/tenant_details_parameters.go delete mode 100644 operatorapi/operations/operator_api/tenant_details_responses.go delete mode 100644 operatorapi/operations/operator_api/tenant_details_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/tenant_encryption_info.go delete mode 100644 operatorapi/operations/operator_api/tenant_encryption_info_parameters.go delete mode 100644 operatorapi/operations/operator_api/tenant_encryption_info_responses.go delete mode 100644 operatorapi/operations/operator_api/tenant_encryption_info_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/tenant_identity_provider.go delete mode 100644 operatorapi/operations/operator_api/tenant_identity_provider_parameters.go delete mode 100644 operatorapi/operations/operator_api/tenant_identity_provider_responses.go delete mode 100644 operatorapi/operations/operator_api/tenant_identity_provider_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/tenant_security.go delete mode 100644 operatorapi/operations/operator_api/tenant_security_parameters.go delete mode 100644 operatorapi/operations/operator_api/tenant_security_responses.go delete mode 100644 operatorapi/operations/operator_api/tenant_security_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/tenant_update_certificate.go delete mode 100644 operatorapi/operations/operator_api/tenant_update_certificate_parameters.go delete mode 100644 operatorapi/operations/operator_api/tenant_update_certificate_responses.go delete mode 100644 operatorapi/operations/operator_api/tenant_update_certificate_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/tenant_update_encryption.go delete mode 100644 operatorapi/operations/operator_api/tenant_update_encryption_parameters.go delete mode 100644 operatorapi/operations/operator_api/tenant_update_encryption_responses.go delete mode 100644 operatorapi/operations/operator_api/tenant_update_encryption_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/tenant_update_pools.go delete mode 100644 operatorapi/operations/operator_api/tenant_update_pools_parameters.go delete mode 100644 operatorapi/operations/operator_api/tenant_update_pools_responses.go delete mode 100644 operatorapi/operations/operator_api/tenant_update_pools_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/update_tenant.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_configuration.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_configuration_parameters.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_configuration_responses.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_configuration_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_domains.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_domains_parameters.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_domains_responses.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_domains_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_identity_provider.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_identity_provider_parameters.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_identity_provider_responses.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_identity_provider_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_parameters.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_responses.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_security.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_security_parameters.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_security_responses.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_security_urlbuilder.go delete mode 100644 operatorapi/operations/operator_api/update_tenant_urlbuilder.go delete mode 100644 operatorapi/operations/user_api/check_min_i_o_version.go delete mode 100644 operatorapi/operations/user_api/check_min_i_o_version_parameters.go delete mode 100644 operatorapi/operations/user_api/check_min_i_o_version_responses.go delete mode 100644 operatorapi/operations/user_api/check_min_i_o_version_urlbuilder.go delete mode 100644 operatorapi/operator_client.go delete mode 100644 operatorapi/operator_subnet.go delete mode 100644 operatorapi/operator_subnet_test.go delete mode 100644 operatorapi/parity.go delete mode 100644 operatorapi/parity_test.go delete mode 100644 operatorapi/proxy.go delete mode 100644 operatorapi/resource_quota.go delete mode 100644 operatorapi/resource_quota_test.go delete mode 100644 operatorapi/server.go delete mode 100644 operatorapi/session.go delete mode 100644 operatorapi/tenant_add.go delete mode 100644 operatorapi/tenant_get.go delete mode 100644 operatorapi/tenant_logs_handlers.go delete mode 100644 operatorapi/tenant_logs_handlers_test.go delete mode 100644 operatorapi/tenant_update.go delete mode 100644 operatorapi/tenants.go delete mode 100644 operatorapi/tenants_2_test.go delete mode 100644 operatorapi/tenants_helper.go delete mode 100644 operatorapi/tenants_helper_test.go delete mode 100644 operatorapi/tenants_test.go delete mode 100644 operatorapi/utils.go delete mode 100644 operatorapi/utils_test.go delete mode 100644 operatorapi/version.go delete mode 100644 operatorapi/volumes.go delete mode 100644 operatorapi/volumes_test.go delete mode 100644 portal-ui/src/screens/Console/Common/TLSCertificate/TLSCertificate.tsx delete mode 100644 portal-ui/src/screens/Console/Common/TolerationSelector/TolerationSelector.tsx delete mode 100644 portal-ui/src/screens/Console/Common/UsageBarWrapper/StackRow.tsx delete mode 100644 portal-ui/src/screens/Console/Common/UsageBarWrapper/SummaryUsageBar.tsx delete mode 100644 portal-ui/src/screens/Console/DirectPV/DirectPVDrives.tsx delete mode 100644 portal-ui/src/screens/Console/DirectPV/DirectPVVolumes.tsx delete mode 100644 portal-ui/src/screens/Console/DirectPV/FormatDrives.tsx delete mode 100644 portal-ui/src/screens/Console/DirectPV/FormatErrorsResult.tsx delete mode 100644 portal-ui/src/screens/Console/DirectPV/directPVSlice.ts delete mode 100644 portal-ui/src/screens/Console/DirectPV/types.ts delete mode 100644 portal-ui/src/screens/Console/Marketplace/Marketplace.tsx delete mode 100644 portal-ui/src/screens/Console/Marketplace/SetEmailModal.tsx delete mode 100644 portal-ui/src/screens/Console/Marketplace/euTimezones.ts delete mode 100644 portal-ui/src/screens/Console/Marketplace/types.tsx delete mode 100644 portal-ui/src/screens/Console/Storage/StoragePVCs.tsx delete mode 100644 portal-ui/src/screens/Console/Storage/types.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/CreateTenantButton.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/NewTenantCredentials.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/Affinity.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/ConfigLogSearch.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/ConfigPrometheus.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/Configure.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/Encryption.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/Encryption/AWSKMSAdd.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/Encryption/AzureKMSAdd.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/Encryption/GCPKMSAdd.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/Encryption/GemaltoKMSAdd.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/Encryption/VaultKMSAdd.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/IdentityProvider.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/IdentityProvider/IDPActiveDirectory.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/IdentityProvider/IDPBuiltIn.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/IdentityProvider/IDPOpenID.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/Images.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/Security.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/SizePreview.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/TenantResources/NameTenantMain.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/TenantResources/NamespaceSelector.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/TenantResources/TenantResources.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/TenantResources/TenantSize.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/TenantResources/TenantSizeMK.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/TenantResources/TenantSizeResources.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/TenantResources/utils.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/Steps/helpers/AddNamespaceModal.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/common.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/createTenantAPI.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/createTenantSlice.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/sliceUtils.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/thunks/createTenantThunk.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/AddTenant/thunks/namespaceThunks.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/HelpBox/TLSHelpBox.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/ListTenants/DeleteTenant.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/ListTenants/InformationItem.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/ListTenants/ListTenants.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/ListTenants/TenantCapacity.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/ListTenants/TenantListItem.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/ListTenants/types.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/ListTenants/utils.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/LogoComponents.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/DeletePVC.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/DeletePod.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/EditDomains.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/EditTenantMonitoringScreen.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/KeyPairEdit.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/LoggingDBDetails.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/LoggingDetails.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/PodsSummary.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/Pools/AddPool/AddPool.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/Pools/AddPool/AddPoolCreateButton.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/Pools/AddPool/PoolConfiguration.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/Pools/AddPool/PoolPodPlacement.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/Pools/AddPool/PoolResources.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/Pools/AddPool/addPoolSlice.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/Pools/AddPool/addPoolThunks.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/Pools/Details/PoolDetails.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/Pools/Details/PoolsListing.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/Pools/EditPool/EditPool.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/Pools/EditPool/EditPoolButton.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/Pools/EditPool/EditPoolConfiguration.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/Pools/EditPool/EditPoolPlacement.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/Pools/EditPool/EditPoolResources.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/Pools/EditPool/editPoolSlice.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/Pools/EditPool/thunks/editPoolAsync.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/Pools/EditPool/types.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/PoolsSummary.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/SubnetLicenseTenant.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/TenantAuditLogsScreen.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/TenantCSR.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/TenantConfiguration.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/TenantDetails.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/TenantEncryption.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/TenantEvents.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/TenantIdentityProvider.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/TenantLicense.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/TenantMetrics.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/TenantSecurity.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/TenantSummary.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/TenantTrace.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/TenantYAML.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/UpdateTenantModal.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/VolumesSummary.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/events/EventsList.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/hop/Hop.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/pods/PodDescribe.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/pods/PodDetails.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/pods/PodEvents.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/pods/PodLogs.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/pvcs/PVCDescribe.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/pvcs/TenantVolumes.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/pvcs/pvcTypes.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/tenantAuditLogSlice.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/tenantMonitoringSlice.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/TenantDetails/utils.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/securityContextSelector.tsx delete mode 100644 portal-ui/src/screens/Console/Tenants/tenantSecurityContextSlice.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/tenantsSlice.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/thunks/tenantDetailsAsync.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/types.ts delete mode 100644 portal-ui/src/screens/Console/Tenants/utils.ts delete mode 100644 portal-ui/tests/operator/login/login.ts delete mode 100644 portal-ui/tests/operator/tenant/test-1/tenant-test-1.ts delete mode 100644 portal-ui/tests/operator/tenant/test-2/tenant-test-2.ts delete mode 100644 portal-ui/tests/operator/utils.ts delete mode 100644 swagger-operator.yml rename swagger-console.yml => swagger.yml (100%) delete mode 100755 tests/common.sh delete mode 100644 tests/console-sa-secret.yaml delete mode 100755 tests/deploy-tenant.sh diff --git a/.github/workflows/jobs.yaml b/.github/workflows/jobs.yaml index 5c32408f2..9d48a68c9 100644 --- a/.github/workflows/jobs.yaml +++ b/.github/workflows/jobs.yaml @@ -717,154 +717,6 @@ jobs: run: | make cleanup-permissions - all-operator-tests-1: - name: Operator UI Tests Part 1 - needs: - - compile-binary - runs-on: ${{ matrix.os }} - strategy: - matrix: - go-version: [ 1.19.x ] - os: [ ubuntu-latest ] - steps: - - name: Check out code - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: ${{ env.NVMRC }} - - name: Install MinIO JS - working-directory: ./ - continue-on-error: false - run: | - yarn add minio - # To build operator image, we need to clone the repository first - - name: clone https://github.com/minio/operator - uses: actions/checkout@master - with: - - # Repository name with owner. For example, actions/checkout - # Default: ${{ github.repository }} - repository: minio/operator - - # Relative path under $GITHUB_WORKSPACE to place the repository - # To have two repositories under the same test - path: 'operator_repository' - - - uses: actions/cache@v3 - name: Console Binary Cache - with: - path: | - ./console - key: ${{ runner.os }}-binary-${{ github.run_id }} - - # Runs a set of commands using the runners shell - - name: Start Kind for Operator UI - run: | - "${GITHUB_WORKSPACE}/portal-ui/tests/scripts/operator.sh" - - - name: Run TestCafe Tests - uses: DevExpress/testcafe-action@latest - with: - args: '"chrome:headless" portal-ui/tests/operator/login --skip-js-errors -c 3' - all-operator-tests-2: - name: Operator UI Tests Part 2 - needs: - - compile-binary - runs-on: ${{ matrix.os }} - strategy: - matrix: - go-version: [ 1.19.x ] - os: [ ubuntu-latest ] - steps: - - name: Check out code - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: ${{ env.NVMRC }} - - name: Install MinIO JS - working-directory: ./ - continue-on-error: false - run: | - yarn add minio - # To build operator image, we need to clone the repository first - - name: clone https://github.com/minio/operator - uses: actions/checkout@master - with: - - # Repository name with owner. For example, actions/checkout - # Default: ${{ github.repository }} - repository: minio/operator - - # Relative path under $GITHUB_WORKSPACE to place the repository - # To have two repositories under the same test - path: 'operator_repository' - - - uses: actions/cache@v3 - name: Console Binary Cache - with: - path: | - ./console - key: ${{ runner.os }}-binary-${{ github.run_id }} - - # Runs a set of commands using the runners shell - - name: Start Kind for Operator UI - run: | - "${GITHUB_WORKSPACE}/portal-ui/tests/scripts/operator.sh" - - - name: Run TestCafe Tests - uses: DevExpress/testcafe-action@latest - with: - args: '"chrome:headless" portal-ui/tests/operator/tenant/test-1 --skip-js-errors -c 3' - all-operator-tests-3: - name: Operator UI Tests Part 3 - needs: - - compile-binary - runs-on: ${{ matrix.os }} - strategy: - matrix: - go-version: [ 1.19.x ] - os: [ ubuntu-latest ] - steps: - - name: Check out code - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: ${{ env.NVMRC }} - - name: Install MinIO JS - working-directory: ./ - continue-on-error: false - run: | - yarn add minio - # To build operator image, we need to clone the repository first - - name: clone https://github.com/minio/operator - uses: actions/checkout@master - with: - - # Repository name with owner. For example, actions/checkout - # Default: ${{ github.repository }} - repository: minio/operator - - # Relative path under $GITHUB_WORKSPACE to place the repository - # To have two repositories under the same test - path: 'operator_repository' - - - uses: actions/cache@v3 - name: Console Binary Cache - with: - path: | - ./console - key: ${{ runner.os }}-binary-${{ github.run_id }} - - # Runs a set of commands using the runners shell - - name: Start Kind for Operator UI - run: | - "${GITHUB_WORKSPACE}/portal-ui/tests/scripts/operator.sh" - - - name: Run TestCafe Tests - uses: DevExpress/testcafe-action@latest - with: - args: '"chrome:headless" portal-ui/tests/operator/tenant/test-2 --skip-js-errors -c 3' - cross-compile-1: name: Cross compile needs: @@ -1094,44 +946,6 @@ jobs: path: | ./restapi/coverage/ key: ${{ runner.os }}-coverage-restapi-2-${{ github.run_id }} - test-operatorapi-on-go: - name: Test Operatorapi on Go ${{ matrix.go-version }} and ${{ matrix.os }} - needs: - - lint-job - - ui-assets - - reuse-golang-dependencies - - semgrep-static-code-analysis - runs-on: ${{ matrix.os }} - strategy: - matrix: - go-version: [ 1.19.x ] - os: [ ubuntu-latest ] - steps: - - name: Check out code - uses: actions/checkout@v3 - - - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go-version }} - cache: true - id: go - - - - name: Build on ${{ matrix.os }} - env: - GO111MODULE: on - GOOS: linux - run: | - make test-unit-test-operator - - - uses: actions/cache@v3 - id: coverage-cache-unittest-operatorapi - name: Coverage Cache unit test operatorAPI - with: - path: | - ./operatorapi/coverage/ - key: ${{ runner.os }}-coverage-unittest-operatorapi-2-${{ github.run_id }} b-integration-tests: name: Integration Tests with Latest Distributed MinIO needs: @@ -1351,68 +1165,11 @@ jobs: path: | ./sso-integration/coverage/ key: ${{ runner.os }}-sso-coverage-2-${{ github.run_id }} - c-operator-api-tests: - - name: Operator API Tests - needs: - - lint-job - - ui-assets - - reuse-golang-dependencies - - semgrep-static-code-analysis - runs-on: ubuntu-latest - - strategy: - matrix: - go-version: [ 1.19.x ] - - steps: - - - uses: actions/checkout@v3 - - - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go-version }} - cache: true - id: go - - # To build operator image, we need to clone the repository first - - name: clone https://github.com/minio/operator - uses: actions/checkout@master - with: - - # Repository name with owner. For example, actions/checkout - # Default: ${{ github.repository }} - repository: minio/operator - - # Relative path under $GITHUB_WORKSPACE to place the repository - # To have two repositories under the same test - path: 'operator_repository' - - - - name: Operator API Tests - run: | - curl -sLO "https://dl.k8s.io/release/v1.23.1/bin/linux/amd64/kubectl" -o kubectl - chmod +x kubectl - mv kubectl /usr/local/bin - "${GITHUB_WORKSPACE}/tests/deploy-tenant.sh" - echo "start ---> make test-operator-integration"; - make test-operator-integration; - - - uses: actions/cache@v3 - id: coverage-cache-operator - name: Coverage Cache Operator - with: - path: | - ./operator-integration/coverage/ - key: ${{ runner.os }}-coverage-2-operator-${{ github.run_id }} coverage: name: "Coverage Limit Check" needs: - b-integration-tests - test-restapi-on-go - - test-operatorapi-on-go - - c-operator-api-tests - test-pkg-on-go - sso-integration - replication @@ -1460,14 +1217,6 @@ jobs: ./replication/coverage/ key: ${{ runner.os }}-replication-coverage-2-${{ github.run_id }} - - uses: actions/cache@v3 - id: coverage-cache-operator - name: Coverage Cache Operator - with: - path: | - ./operator-integration/coverage/ - key: ${{ runner.os }}-coverage-2-operator-${{ github.run_id }} - - uses: actions/cache@v3 id: coverage-cache-restapi name: Coverage Cache RestAPI @@ -1476,14 +1225,6 @@ jobs: ./restapi/coverage/ key: ${{ runner.os }}-coverage-restapi-2-${{ github.run_id }} - - uses: actions/cache@v3 - id: coverage-cache-unittest-operatorapi - name: Coverage Cache unit test operatorAPI - with: - path: | - ./operatorapi/coverage/ - key: ${{ runner.os }}-coverage-unittest-operatorapi-2-${{ github.run_id }} - - uses: actions/cache@v3 id: coverage-cache-pkg name: Coverage Cache Pkg @@ -1509,7 +1250,7 @@ jobs: echo "go build gocoverage.go" go build gocovmerge.go echo "put together the outs for final coverage resolution" - ./gocovmerge ../integration/coverage/system.out ../replication/coverage/replication.out ../sso-integration/coverage/sso-system.out ../restapi/coverage/coverage.out ../pkg/coverage/coverage-pkg.out ../operator-integration/coverage/operator-api.out ../operatorapi/coverage/coverage-unit-test-operatorapi.out > all.out + ./gocovmerge ../integration/coverage/system.out ../replication/coverage/replication.out ../sso-integration/coverage/sso-system.out ../restapi/coverage/coverage.out ../pkg/coverage/coverage-pkg.out > all.out echo "Download mc for Ubuntu" wget -q https://dl.min.io/client/mc/release/linux-amd64/mc echo "Change the permissions to execute mc command" diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 511cc53ed..4aa4679f6 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -1,3 +1,72 @@ +# Building with MinIO + +To test console in its shipping format, you need to build it from the MinIO repository, the following step will guide +you to do that. + +### 0. Building with UI Changes + +If you are performing changes in the UI components of console and want to test inside the MinIO binary, you need to +build assets first. + +In the console folder run + +```shell +make assets +``` + +This will regenerate all the static assets that will be served by MinIO. + +### 1. Clone the `MinIO` repository + +In the parent folder of where you cloned this `console` repository, clone the MinIO Repository + +```shell +git clone https://github.com/minio/minio.git +``` + +### 2. Update `go.mod` to use your local version + +In the MinIO repository open `go.mod` and after the first `require()` directive add a `replace()` directive + +``` +... +) + +replace ( +github.com/minio/console => "../console" +) + +require ( +... +``` + +### 3. Build `MinIO` + +Still in the MinIO folder, run + +```shell +make build +``` + +# Testing on Kubernetes + +If you want to test console on kubernetes, you can perform all the steps from `Building with MinIO`, but change `Step 3` +to the following: + +```shell +TAG=miniodev/console:dev make docker +``` + +This will build a docker container image that can be used to test with your local kubernetes environment. + +For example, if you are using kind: + +```shell +kind load docker-image miniodev/console:dev +``` + +and then deploy any `Tenant` that uses this image + # LDAP authentication with Console ## Setup @@ -15,7 +84,8 @@ $ docker cp console/docs/ldap/billy.ldif my-openldap-container:/container/servic $ docker exec my-openldap-container ldapadd -x -D "cn=admin,dc=example,dc=org" -w admin -f /container/service/slapd/assets/test/billy.ldif -H ldap://localhost ``` -Query the ldap server to check the user billy was created correctly and got assigned to the consoleAdmin group, you should get a list +Query the ldap server to check the user billy was created correctly and got assigned to the consoleAdmin group, you +should get a list containing ldap users and groups. ``` @@ -30,7 +100,7 @@ $ docker exec my-openldap-container ldapsearch -x -H ldap://localhost -b uid=bil ### Change the password for user billy -Set the new password for `billy` to `minio123` and enter `admin` as the default `LDAP Password` +Set the new password for `billy` to `minio123` and enter `admin` as the default `LDAP Password` ``` $ docker exec -it my-openldap-container /bin/bash @@ -41,6 +111,7 @@ Enter LDAP Password: ``` ### Add the consoleAdmin policy to user billy on MinIO + ``` $ cat > consoleAdmin.json << EOF { diff --git a/Makefile b/Makefile index 58422dd4b..cb545fa70 100644 --- a/Makefile +++ b/Makefile @@ -13,12 +13,7 @@ default: console .PHONY: console console: @echo "Building Console binary to './console'" - @(GO111MODULE=on CGO_ENABLED=0 go build -trimpath --tags=kqueue,operator --ldflags "-s -w" -o console ./cmd/console) - -k8sdev: - @docker build -t $(TAG) --build-arg build_version=$(BUILD_VERSION) --build-arg build_time='$(BUILD_TIME)' --build-arg NODE_VERSION='$(NODE_VERSION)' . - @kind load docker-image $(TAG) - @echo "Done, now restart your console deployment" + @(GO111MODULE=on CGO_ENABLED=0 go build -trimpath --tags=kqueue --ldflags "-s -w" -o console ./cmd/console) getdeps: @mkdir -p ${GOPATH}/bin @@ -43,7 +38,7 @@ install: console @mkdir -p $(GOPATH)/bin && cp -f $(PWD)/console $(GOPATH)/bin/console @echo "Installation successful. To learn more, try \"console --help\"." -swagger-gen: clean-swagger swagger-console swagger-operator apply-gofmt +swagger-gen: clean-swagger swagger-console apply-gofmt @echo "Done Generating swagger server code from yaml" apply-gofmt: @@ -54,15 +49,11 @@ clean-swagger: @echo "cleaning" @rm -rf models @rm -rf restapi/operations - @rm -rf operatorapi/operations swagger-console: @echo "Generating swagger server code from yaml" - @swagger generate server -A console --main-package=management --server-package=restapi --exclude-main -P models.Principal -f ./swagger-console.yml -r NOTICE + @swagger generate server -A console --main-package=management --server-package=restapi --exclude-main -P models.Principal -f ./swagger.yml -r NOTICE -swagger-operator: - @echo "Generating swagger server code from yaml" - @swagger generate server -A operator --main-package=operator --server-package=operatorapi --exclude-main -P models.Principal -f ./swagger-operator.yml -r NOTICE assets: @(if [ -f "${NVM_DIR}/nvm.sh" ]; then \. "${NVM_DIR}/nvm.sh" && nvm install && nvm use && npm install -g yarn ; fi &&\ @@ -188,15 +179,6 @@ test-sso-integration: @echo "Executing the test:" @(cd sso-integration && go test -coverpkg=../restapi -c -tags testrunmain . && mkdir -p coverage && ./sso-integration.test -test.v -test.run "^Test*" -test.coverprofile=coverage/sso-system.out) -test-operator-integration: - @(echo "Start cd operator-integration && go test:") - @(pwd) - @(cd operator-integration && go test -coverpkg=../operatorapi -c -tags testrunmain . && mkdir -p coverage && ./operator-integration.test -test.v -test.run "^Test*" -test.coverprofile=coverage/operator-api.out) - -test-operator: - @(env bash $(PWD)/portal-ui/tests/scripts/operator.sh) - @(docker stop minio) - test-permissions-1: @(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4}) @(env bash $(PWD)/portal-ui/tests/scripts/permissions.sh "portal-ui/tests/permissions-1/") @@ -238,9 +220,6 @@ test-apply-permissions: test-start-docker-minio: @(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4}) -initialize-operator: - @echo "Done initializing operator test" - initialize-permissions: test-start-docker-minio test-apply-permissions @echo "Done initializing permissions test" @@ -252,9 +231,6 @@ test: @echo "execute test and get coverage" @(cd restapi && mkdir coverage && GO111MODULE=on go test -test.v -coverprofile=coverage/coverage.out) -test-unit-test-operator: - @echo "execute unit test and get coverage for operatorapi" - @(cd operatorapi && mkdir coverage && GO111MODULE=on go test -test.v -coverprofile=coverage/coverage-unit-test-operatorapi.out) test-pkg: @echo "execute test and get coverage" @@ -275,7 +251,5 @@ docker: release: swagger-gen @echo "Generating Release: $(RELEASE)" @make assets - @yq -i e '.spec.template.spec.containers[0].image |= "minio/console:$(RELEASE)"' k8s/operator-console/base/console-deployment.yaml - @yq -i e 'select(.kind == "Deployment").spec.template.spec.containers[0].image |= "minio/console:$(RELEASE)"' k8s/operator-console/standalone/console-deployment.yaml @git add -u . @git add portal-ui/build/ diff --git a/cmd/console/app_commands.go b/cmd/console/app_commands.go index ba06a43ca..459c5f045 100644 --- a/cmd/console/app_commands.go +++ b/cmd/console/app_commands.go @@ -1,6 +1,3 @@ -//go:build operator -// +build operator - // This file is part of MinIO Console Server // Copyright (c) 2021 MinIO, Inc. // @@ -22,7 +19,6 @@ package main import ( "context" "fmt" - "os" "strconv" "time" @@ -35,12 +31,10 @@ import ( var appCmds = []cli.Command{ serverCmd, updateCmd, - operatorCmd, } // StartServer starts the console service func StartServer(ctx *cli.Context) error { - // Load all certificates if err := loadAllCerts(ctx); err != nil { // Log this as a warning and continue running console without TLS certificates restapi.LogError("Unable to load certs: %v", err) @@ -57,10 +51,6 @@ func StartServer(ctx *cli.Context) error { restapi.LogError = logger.Error restapi.LogIf = logger.LogIf - if os.Getenv("CONSOLE_OPERATOR_MODE") != "" && os.Getenv("CONSOLE_OPERATOR_MODE") == "on" { - return startOperatorServer(ctx) - } - var rctx restapi.Context if err := rctx.Load(ctx); err != nil { restapi.LogError("argument validation failed: %v", err) diff --git a/cmd/console/app_commands_noop.go b/cmd/console/app_commands_noop.go deleted file mode 100644 index 6d9161143..000000000 --- a/cmd/console/app_commands_noop.go +++ /dev/null @@ -1,92 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -//go:build !operator -// +build !operator - -package main - -import ( - "context" - "fmt" - "strconv" - "time" - - "github.com/minio/console/pkg/logger" - - "github.com/minio/cli" - "github.com/minio/console/restapi" -) - -var appCmds = []cli.Command{ - serverCmd, - updateCmd, -} - -// StartServer starts the console service -func StartServer(ctx *cli.Context) error { - if err := loadAllCerts(ctx); err != nil { - // Log this as a warning and continue running console without TLS certificates - restapi.LogError("Unable to load certs: %v", err) - } - - xctx := context.Background() - transport := restapi.PrepareSTSClientTransport(false) - if err := logger.InitializeLogger(xctx, transport); err != nil { - fmt.Println("error InitializeLogger", err) - logger.CriticalIf(xctx, err) - } - // custom error configuration - restapi.LogInfo = logger.Info - restapi.LogError = logger.Error - restapi.LogIf = logger.LogIf - - var rctx restapi.Context - if err := rctx.Load(ctx); err != nil { - restapi.LogError("argument validation failed: %v", err) - return err - } - - server, err := buildServer() - if err != nil { - restapi.LogError("Unable to initialize console server: %v", err) - return err - } - - server.Host = rctx.Host - server.Port = rctx.HTTPPort - // set conservative timesout for uploads - server.ReadTimeout = 1 * time.Hour - // no timeouts for response for downloads - server.WriteTimeout = 0 - restapi.Port = strconv.Itoa(server.Port) - restapi.Hostname = server.Host - - if len(restapi.GlobalPublicCerts) > 0 { - // If TLS certificates are provided enforce the HTTPS schema, meaning console will redirect - // plain HTTP connections to HTTPS server - server.EnabledListeners = []string{"http", "https"} - server.TLSPort = rctx.HTTPSPort - // Need to store tls-port, tls-host un config variables so secure.middleware can read from there - restapi.TLSPort = strconv.Itoa(server.TLSPort) - restapi.Hostname = rctx.Host - restapi.TLSRedirect = rctx.TLSRedirect - } - - defer server.Shutdown() - - return server.Serve() -} diff --git a/cmd/console/operator.go b/cmd/console/operator.go deleted file mode 100644 index b2ea4b0ad..000000000 --- a/cmd/console/operator.go +++ /dev/null @@ -1,188 +0,0 @@ -//go:build operator -// +build operator - -// This file is part of MinIO Console Server -// Copyright (c) 2022 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package main - -import ( - "context" - "fmt" - "strconv" - "time" - - "github.com/minio/console/pkg/logger" - - "github.com/minio/console/restapi" - - "github.com/go-openapi/loads" - "github.com/jessevdk/go-flags" - "github.com/minio/cli" - "github.com/minio/console/operatorapi" - "github.com/minio/console/operatorapi/operations" - "github.com/minio/console/pkg/certs" -) - -// starts the server -var operatorCmd = cli.Command{ - Name: "operator", - Aliases: []string{"opr"}, - Usage: "Start MinIO Operator UI server", - Action: startOperatorServer, - Flags: []cli.Flag{ - cli.StringFlag{ - Name: "host", - Value: restapi.GetHostname(), - Usage: "bind to a specific HOST, HOST can be an IP or hostname", - }, - cli.IntFlag{ - Name: "port", - Value: restapi.GetPort(), - Usage: "bind to specific HTTP port", - }, - // This is kept here for backward compatibility, - // hostname's do not have HTTP or HTTPs - // hostnames are opaque so using --host - // works for both HTTP and HTTPS setup. - cli.StringFlag{ - Name: "tls-host", - Value: restapi.GetHostname(), - Hidden: true, - }, - cli.StringFlag{ - Name: "certs-dir", - Value: certs.GlobalCertsCADir.Get(), - Usage: "path to certs directory", - }, - cli.IntFlag{ - Name: "tls-port", - Value: restapi.GetTLSPort(), - Usage: "bind to specific HTTPS port", - }, - cli.StringFlag{ - Name: "tls-redirect", - Value: restapi.GetTLSRedirect(), - Usage: "toggle HTTP->HTTPS redirect", - }, - cli.StringFlag{ - Name: "tls-certificate", - Value: "", - Usage: "path to TLS public certificate", - Hidden: true, - }, - cli.StringFlag{ - Name: "tls-key", - Value: "", - Usage: "path to TLS private key", - Hidden: true, - }, - cli.StringFlag{ - Name: "tls-ca", - Value: "", - Usage: "path to TLS Certificate Authority", - Hidden: true, - }, - }, -} - -func buildOperatorServer() (*operatorapi.Server, error) { - swaggerSpec, err := loads.Embedded(operatorapi.SwaggerJSON, operatorapi.FlatSwaggerJSON) - if err != nil { - return nil, err - } - - api := operations.NewOperatorAPI(swaggerSpec) - api.Logger = restapi.LogInfo - server := operatorapi.NewServer(api) - - parser := flags.NewParser(server, flags.Default) - parser.ShortDescription = "MinIO Console Server" - parser.LongDescription = swaggerSpec.Spec().Info.Description - - server.ConfigureFlags() - - // register all APIs - server.ConfigureAPI() - - for _, optsGroup := range api.CommandLineOptionsGroups { - _, err := parser.AddGroup(optsGroup.ShortDescription, optsGroup.LongDescription, optsGroup.Options) - if err != nil { - return nil, err - } - } - - if _, err := parser.Parse(); err != nil { - return nil, err - } - - return server, nil -} - -// StartServer starts the console service -func startOperatorServer(ctx *cli.Context) error { - if err := loadAllCerts(ctx); err != nil { - // Log this as a warning and continue running console without TLS certificates - restapi.LogError("Unable to load certs: %v", err) - } - - xctx := context.Background() - transport := restapi.PrepareSTSClientTransport(false) - if err := logger.InitializeLogger(xctx, transport); err != nil { - fmt.Println("error InitializeLogger", err) - logger.CriticalIf(xctx, err) - } - // custom error configuration - restapi.LogInfo = logger.Info - restapi.LogError = logger.Error - restapi.LogIf = logger.LogIf - - var rctx operatorapi.Context - if err := rctx.Load(ctx); err != nil { - restapi.LogError("argument validation failed: %v", err) - return err - } - - server, err := buildOperatorServer() - if err != nil { - restapi.LogError("Unable to initialize console server: %v", err) - return err - } - - server.Host = rctx.Host - server.Port = rctx.HTTPPort - // set conservative timesout for uploads - server.ReadTimeout = 1 * time.Hour - // no timeouts for response for downloads - server.WriteTimeout = 0 - operatorapi.Port = strconv.Itoa(server.Port) - operatorapi.Hostname = server.Host - - if len(restapi.GlobalPublicCerts) > 0 { - // If TLS certificates are provided enforce the HTTPS schema, meaning console will redirect - // plain HTTP connections to HTTPS server - server.EnabledListeners = []string{"http", "https"} - server.TLSPort = rctx.HTTPSPort - // Need to store tls-port, tls-host un config variables so secure.middleware can read from there - operatorapi.TLSPort = strconv.Itoa(server.TLSPort) - operatorapi.Hostname = rctx.Host - operatorapi.TLSRedirect = rctx.TLSRedirect - } - - defer server.Shutdown() - - return server.Serve() -} diff --git a/docs/console_operator_mode.md b/docs/console_operator_mode.md deleted file mode 100644 index 056e7f2e5..000000000 --- a/docs/console_operator_mode.md +++ /dev/null @@ -1,39 +0,0 @@ -# Running Console in Operator mode - -`Console` will authenticate against `Kubernetes`using bearer tokens via HTTP `Authorization` header. The user will provide this token once -in the login form, Console will validate it against Kubernetes (list apis) and if valid will generate and return a new Console sessions -with encrypted claims (the user Service account token will be inside the session encrypted token - -# Kubernetes - -The provided `JWT token` corresponds to the `Kubernetes service account` that `Console` will use to run tasks on behalf of the -user, ie: list, create, edit, delete tenants, storage class, etc. - - -# Development - -If console is running inside a k8s pod `KUBERNETES_SERVICE_HOST` and `KUBERNETES_SERVICE_PORT` will contain the k8s api server apiServerAddress -if console is not running inside k8s by default will look for the k8s api server on `localhost:8001` (kubectl proxy) - -If you are running console in your local environment and wish to make request to `Kubernetes` you can set `CONSOLE_K8S_API_SERVER`, if -the environment variable is not present by default `Console` will use `"http://localhost:8001"`, additionally you will need to set the -`CONSOLE_OPERATOR_MODE=on` variable to make Console display the Operator UI. - -NOTE: using `kubectl` proxy is for local development only, since every request send to localhost:8001 will bypass service account authentication -more info here: https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/#directly-accessing-the-rest-api -you can override this using `CONSOLE_K8S_API_SERVER`, ie use the k8s cluster from `kubectl config view` - -## Extract the Service account token and use it with Console - -For local development you can use the jwt associated to the `console-sa` service account, you can get the token running -the following command in your terminal: - -``` -kubectl get secret $(kubectl get serviceaccount console-sa -o jsonpath="{.secrets[0].name}") -o jsonpath="{.data.token}" | base64 --decode -``` - -Then run the Console server - -``` -CONSOLE_OPERATOR_MODE=on ./console server -``` diff --git a/k8s/boilerplate.go.txt b/k8s/boilerplate.go.txt deleted file mode 100644 index 6611a5f69..000000000 --- a/k8s/boilerplate.go.txt +++ /dev/null @@ -1,15 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . diff --git a/k8s/create-kind.sh b/k8s/create-kind.sh deleted file mode 100755 index 447adbcc1..000000000 --- a/k8s/create-kind.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -# setup environment variables based on flags to see if we should build the docker containers again -CONSOLE_DOCKER="true" - -# evaluate flags -# `-m` for console - - -while getopts ":m:" opt; do - case $opt in - m) - CONSOLE_DOCKER="$OPTARG" - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - exit 1 - ;; - :) - echo "Option -$OPTARG requires an argument." >&2 - exit 1 - ;; - esac -done - -echo "Provisioning Kind" -kind create cluster --config kind-cluster.yaml -echo "Remove Master Taint" -kubectl taint nodes --all node-role.kubernetes.io/master- -echo "Install Contour" -kubectl apply -f https://projectcontour.io/quickstart/contour.yaml -kubectl patch daemonsets -n projectcontour envoy -p '{"spec":{"template":{"spec":{"nodeSelector":{"ingress-ready":"true"},"tolerations":[{"key":"node-role.kubernetes.io/master","operator":"Equal","effect":"NoSchedule"}]}}}}' -echo "install metrics server" -kubectl apply -f metrics-dev.yaml - -# Whether or not to build the m3 container and load it to kind or just load it -if [[ $CONSOLE_DOCKER == "true" ]]; then - # Build mkube - make --directory=".." k8sdev TAG=minio/console:latest -else - kind load docker-image minio/console:latest -fi - -echo "done" diff --git a/k8s/kind-cluster.yaml b/k8s/kind-cluster.yaml deleted file mode 100644 index c1529aa5d..000000000 --- a/k8s/kind-cluster.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# three node (two workers) cluster config -kind: Cluster -apiVersion: kind.x-k8s.io/v1alpha4 -nodes: -- role: control-plane - kubeadmConfigPatches: - - | - kind: InitConfiguration - nodeRegistration: - kubeletExtraArgs: - node-labels: "ingress-ready=true" - extraPortMappings: - - containerPort: 80 - hostPort: 8844 - protocol: TCP - - containerPort: 443 - hostPort: 8843 - protocol: TCP -#- role: worker -#- role: worker -#- role: worker -#- role: worker diff --git a/k8s/metrics-dev.yaml b/k8s/metrics-dev.yaml deleted file mode 100644 index 4b3c44f7d..000000000 --- a/k8s/metrics-dev.yaml +++ /dev/null @@ -1,153 +0,0 @@ ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: system:aggregated-metrics-reader - labels: - rbac.authorization.k8s.io/aggregate-to-view: "true" - rbac.authorization.k8s.io/aggregate-to-edit: "true" - rbac.authorization.k8s.io/aggregate-to-admin: "true" -rules: - - apiGroups: ["metrics.k8s.io"] - resources: ["pods", "nodes"] - verbs: ["get", "list", "watch"] ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: metrics-server:system:auth-delegator -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: system:auth-delegator -subjects: - - kind: ServiceAccount - name: metrics-server - namespace: kube-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: metrics-server-auth-reader - namespace: kube-system -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: extension-apiserver-authentication-reader -subjects: - - kind: ServiceAccount - name: metrics-server - namespace: kube-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: system:metrics-server -rules: - - apiGroups: - - "" - resources: - - pods - - nodes - - nodes/stats - - namespaces - - configmaps - verbs: - - get - - list - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: system:metrics-server -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: system:metrics-server -subjects: - - kind: ServiceAccount - name: metrics-server - namespace: kube-system ---- -apiVersion: apiregistration.k8s.io/v1beta1 -kind: APIService -metadata: - name: v1beta1.metrics.k8s.io -spec: - service: - name: metrics-server - namespace: kube-system - group: metrics.k8s.io - version: v1beta1 - insecureSkipTLSVerify: true - groupPriorityMinimum: 100 - versionPriority: 100 ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: metrics-server - namespace: kube-system ---- -apiVersion: v1 -kind: Service -metadata: - name: metrics-server - namespace: kube-system - labels: - kubernetes.io/name: "Metrics-server" - kubernetes.io/cluster-service: "true" -spec: - selector: - k8s-app: metrics-server - ports: - - port: 443 - protocol: TCP - targetPort: main-port ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: metrics-server - namespace: kube-system - labels: - k8s-app: metrics-server -spec: - selector: - matchLabels: - k8s-app: metrics-server - template: - metadata: - name: metrics-server - labels: - k8s-app: metrics-server - spec: - serviceAccountName: metrics-server - volumes: - # mount in tmp so we can safely use from-scratch images and/or read-only containers - - name: tmp-dir - emptyDir: {} - containers: - - name: metrics-server - image: k8s.gcr.io/metrics-server-amd64:v0.3.6 - args: - - --cert-dir=/tmp - - --secure-port=4443 - - --kubelet-insecure-tls - - --kubelet-preferred-address-types=InternalIP - ports: - - name: main-port - containerPort: 4443 - protocol: TCP - securityContext: - readOnlyRootFilesystem: true - runAsNonRoot: true - runAsUser: 1000 - imagePullPolicy: Always - volumeMounts: - - name: tmp-dir - mountPath: /tmp - nodeSelector: - kubernetes.io/os: linux - kubernetes.io/arch: "amd64" diff --git a/k8s/operator-console/base/console-cluster-role-binding.yaml b/k8s/operator-console/base/console-cluster-role-binding.yaml deleted file mode 100644 index d1c631b25..000000000 --- a/k8s/operator-console/base/console-cluster-role-binding.yaml +++ /dev/null @@ -1,12 +0,0 @@ -kind: ClusterRoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: console-sa-binding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: console-sa-role -subjects: - - kind: ServiceAccount - name: console-sa - namespace: default diff --git a/k8s/operator-console/base/console-cluster-role.yaml b/k8s/operator-console/base/console-cluster-role.yaml deleted file mode 100644 index 020a02f98..000000000 --- a/k8s/operator-console/base/console-cluster-role.yaml +++ /dev/null @@ -1,234 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: console-sa-role -rules: - - apiGroups: - - "" - resources: - - secrets - verbs: - - get - - watch - - create - - list - - patch - - update - - deletecollection - - apiGroups: - - "" - resources: - - namespaces - - services - - events - - resourcequotas - - nodes - verbs: - - get - - watch - - create - - list - - patch - - apiGroups: - - "" - resources: - - pods - verbs: - - get - - watch - - create - - list - - patch - - delete - - deletecollection - - apiGroups: - - "" - resources: - - persistentvolumeclaims - verbs: - - deletecollection - - list - - get - - watch - - update - - apiGroups: - - "storage.k8s.io" - resources: - - storageclasses - verbs: - - get - - watch - - create - - list - - patch - - apiGroups: - - apps - resources: - - statefulsets - - deployments - verbs: - - get - - create - - list - - patch - - watch - - update - - delete - - apiGroups: - - batch - resources: - - jobs - verbs: - - get - - create - - list - - patch - - watch - - update - - delete - - apiGroups: - - "certificates.k8s.io" - resources: - - "certificatesigningrequests" - - "certificatesigningrequests/approval" - - "certificatesigningrequests/status" - verbs: - - update - - create - - get - - apiGroups: - - minio.min.io - resources: - - "*" - verbs: - - "*" - - apiGroups: - - min.io - resources: - - "*" - verbs: - - "*" - - apiGroups: - - "" - resources: - - persistentvolumes - verbs: - - get - - list - - watch - - create - - delete - - apiGroups: - - "" - resources: - - persistentvolumeclaims - verbs: - - get - - list - - watch - - update - - apiGroups: - - "" - resources: - - events - verbs: - - create - - list - - watch - - update - - patch - - apiGroups: - - snapshot.storage.k8s.io - resources: - - volumesnapshots - verbs: - - get - - list - - apiGroups: - - snapshot.storage.k8s.io - resources: - - volumesnapshotcontents - verbs: - - get - - list - - apiGroups: - - storage.k8s.io - resources: - - csinodes - verbs: - - get - - list - - watch - - apiGroups: - - storage.k8s.io - resources: - - volumeattachments - verbs: - - get - - list - - watch - - apiGroups: - - "" - resources: - - endpoints - verbs: - - get - - list - - watch - - create - - update - - delete - - apiGroups: - - coordination.k8s.io - resources: - - leases - verbs: - - get - - list - - watch - - create - - update - - delete - - apiGroups: - - direct.csi.min.io - resources: - - volumes - verbs: - - get - - list - - watch - - create - - update - - delete - - apiGroups: - - apiextensions.k8s.io - resources: - - customresourcedefinitions - verbs: - - get - - list - - watch - - create - - update - - delete - - apiGroups: - - direct.csi.min.io - resources: - - directcsidrives - - directcsivolumes - verbs: - - get - - list - - watch - - create - - update - - delete - - apiGroups: - - "" - resources: - - pod - - pods/log - verbs: - - get - - list - - watch diff --git a/k8s/operator-console/base/console-configmap.yaml b/k8s/operator-console/base/console-configmap.yaml deleted file mode 100644 index 0a38bcf1e..000000000 --- a/k8s/operator-console/base/console-configmap.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: console-env -data: - CONSOLE_PORT: "9090" - CONSOLE_TLS_PORT: "9443" diff --git a/k8s/operator-console/base/console-deployment.yaml b/k8s/operator-console/base/console-deployment.yaml deleted file mode 100644 index b2702611c..000000000 --- a/k8s/operator-console/base/console-deployment.yaml +++ /dev/null @@ -1,29 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: console -spec: - replicas: 1 - selector: - matchLabels: - app: console - template: - metadata: - labels: - app: console - spec: - serviceAccountName: console-sa - containers: - - name: console - image: 'minio/console:v0.24.0' - imagePullPolicy: "IfNotPresent" - env: - - name: CONSOLE_OPERATOR_MODE - value: "on" - args: - - server - ports: - - containerPort: 9090 - name: http - - containerPort: 9433 - name: https diff --git a/k8s/operator-console/base/console-service-account.yaml b/k8s/operator-console/base/console-service-account.yaml deleted file mode 100644 index a9b558206..000000000 --- a/k8s/operator-console/base/console-service-account.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: console-sa - namespace: default diff --git a/k8s/operator-console/base/console-service.yaml b/k8s/operator-console/base/console-service.yaml deleted file mode 100644 index e66fe2f7e..000000000 --- a/k8s/operator-console/base/console-service.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: console - labels: - name: console -spec: - ports: - - port: 9090 - name: http - - port: 9443 - name: https - selector: - app: console diff --git a/k8s/operator-console/base/kustomization.yaml b/k8s/operator-console/base/kustomization.yaml deleted file mode 100644 index fb0d31644..000000000 --- a/k8s/operator-console/base/kustomization.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -# beginning of customizations -resources: - - console-service-account.yaml - - console-cluster-role.yaml - - console-cluster-role-binding.yaml - - console-configmap.yaml - - console-service.yaml - - console-deployment.yaml diff --git a/k8s/operator-console/standalone/console-deployment.yaml b/k8s/operator-console/standalone/console-deployment.yaml deleted file mode 100644 index cd84645cb..000000000 --- a/k8s/operator-console/standalone/console-deployment.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: console - namespace: default - labels: - name: console -spec: - ports: - - port: 9090 - name: http - - port: 9443 - name: https - selector: - app: console-standalone ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: console - namespace: default -spec: - replicas: 1 - selector: - matchLabels: - app: console-standalone - template: - metadata: - labels: - app: console-standalone - spec: - containers: - - name: console - image: 'minio/console:v0.24.0' - imagePullPolicy: "IfNotPresent" - env: - - name: CONSOLE_MINIO_SERVER - value: "https://minio.default.svc.cluster.local" - args: - - server - ports: - - containerPort: 9090 - name: http - - containerPort: 9433 - name: https diff --git a/k8s/tools.go b/k8s/tools.go deleted file mode 100644 index 7b177b008..000000000 --- a/k8s/tools.go +++ /dev/null @@ -1,20 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Package k8s - this package imports things required by build scripts, to force `go mod` to see them as dependencies -package k8s - -// import _ "k8s.io/code-generator" diff --git a/k8s/update-codegen.sh b/k8s/update-codegen.sh deleted file mode 100755 index d54083933..000000000 --- a/k8s/update-codegen.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2017 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -o errexit -set -o nounset -set -o pipefail - -SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. -CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)} - -# generate the code with: -# --output-base because this script should also be able to run inside the vendor dir of -# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir -# instead of the $GOPATH directly. For normal projects this can be dropped. -bash "${CODEGEN_PKG}"/generate-groups.sh "all" \ - github.com/minio/console/pkg/generated \ - github.com/minio/console/pkg/apis \ - mkube:v1 \ - --go-header-file "${SCRIPT_ROOT}"/k8s/boilerplate.go.txt - -# To use your own boilerplate text append: -# --go-header-file "${SCRIPT_ROOT}"/hack/custom-boilerplate.go.txt diff --git a/models/allocatable_resources_response.go b/models/allocatable_resources_response.go deleted file mode 100644 index f2cc64c5c..000000000 --- a/models/allocatable_resources_response.go +++ /dev/null @@ -1,173 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// AllocatableResourcesResponse allocatable resources response -// -// swagger:model allocatableResourcesResponse -type AllocatableResourcesResponse struct { - - // cpu priority - CPUPriority *NodeMaxAllocatableResources `json:"cpu_priority,omitempty"` - - // mem priority - MemPriority *NodeMaxAllocatableResources `json:"mem_priority,omitempty"` - - // min allocatable cpu - MinAllocatableCPU int64 `json:"min_allocatable_cpu,omitempty"` - - // min allocatable mem - MinAllocatableMem int64 `json:"min_allocatable_mem,omitempty"` -} - -// Validate validates this allocatable resources response -func (m *AllocatableResourcesResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateCPUPriority(formats); err != nil { - res = append(res, err) - } - - if err := m.validateMemPriority(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *AllocatableResourcesResponse) validateCPUPriority(formats strfmt.Registry) error { - if swag.IsZero(m.CPUPriority) { // not required - return nil - } - - if m.CPUPriority != nil { - if err := m.CPUPriority.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("cpu_priority") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("cpu_priority") - } - return err - } - } - - return nil -} - -func (m *AllocatableResourcesResponse) validateMemPriority(formats strfmt.Registry) error { - if swag.IsZero(m.MemPriority) { // not required - return nil - } - - if m.MemPriority != nil { - if err := m.MemPriority.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("mem_priority") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("mem_priority") - } - return err - } - } - - return nil -} - -// ContextValidate validate this allocatable resources response based on the context it is used -func (m *AllocatableResourcesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateCPUPriority(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateMemPriority(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *AllocatableResourcesResponse) contextValidateCPUPriority(ctx context.Context, formats strfmt.Registry) error { - - if m.CPUPriority != nil { - if err := m.CPUPriority.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("cpu_priority") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("cpu_priority") - } - return err - } - } - - return nil -} - -func (m *AllocatableResourcesResponse) contextValidateMemPriority(ctx context.Context, formats strfmt.Registry) error { - - if m.MemPriority != nil { - if err := m.MemPriority.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("mem_priority") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("mem_priority") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *AllocatableResourcesResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *AllocatableResourcesResponse) UnmarshalBinary(b []byte) error { - var res AllocatableResourcesResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/annotation.go b/models/annotation.go deleted file mode 100644 index d9e9efb7a..000000000 --- a/models/annotation.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// Annotation annotation -// -// swagger:model annotation -type Annotation struct { - - // key - Key string `json:"key,omitempty"` - - // value - Value string `json:"value,omitempty"` -} - -// Validate validates this annotation -func (m *Annotation) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this annotation based on context it is used -func (m *Annotation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *Annotation) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *Annotation) UnmarshalBinary(b []byte) error { - var res Annotation - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/aws_configuration.go b/models/aws_configuration.go deleted file mode 100644 index 1f1c52a99..000000000 --- a/models/aws_configuration.go +++ /dev/null @@ -1,329 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// AwsConfiguration aws configuration -// -// swagger:model awsConfiguration -type AwsConfiguration struct { - - // secretsmanager - // Required: true - Secretsmanager *AwsConfigurationSecretsmanager `json:"secretsmanager"` -} - -// Validate validates this aws configuration -func (m *AwsConfiguration) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateSecretsmanager(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *AwsConfiguration) validateSecretsmanager(formats strfmt.Registry) error { - - if err := validate.Required("secretsmanager", "body", m.Secretsmanager); err != nil { - return err - } - - if m.Secretsmanager != nil { - if err := m.Secretsmanager.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("secretsmanager") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("secretsmanager") - } - return err - } - } - - return nil -} - -// ContextValidate validate this aws configuration based on the context it is used -func (m *AwsConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateSecretsmanager(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *AwsConfiguration) contextValidateSecretsmanager(ctx context.Context, formats strfmt.Registry) error { - - if m.Secretsmanager != nil { - if err := m.Secretsmanager.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("secretsmanager") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("secretsmanager") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *AwsConfiguration) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *AwsConfiguration) UnmarshalBinary(b []byte) error { - var res AwsConfiguration - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// AwsConfigurationSecretsmanager aws configuration secretsmanager -// -// swagger:model AwsConfigurationSecretsmanager -type AwsConfigurationSecretsmanager struct { - - // credentials - // Required: true - Credentials *AwsConfigurationSecretsmanagerCredentials `json:"credentials"` - - // endpoint - // Required: true - Endpoint *string `json:"endpoint"` - - // kmskey - Kmskey string `json:"kmskey,omitempty"` - - // region - // Required: true - Region *string `json:"region"` -} - -// Validate validates this aws configuration secretsmanager -func (m *AwsConfigurationSecretsmanager) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateCredentials(formats); err != nil { - res = append(res, err) - } - - if err := m.validateEndpoint(formats); err != nil { - res = append(res, err) - } - - if err := m.validateRegion(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *AwsConfigurationSecretsmanager) validateCredentials(formats strfmt.Registry) error { - - if err := validate.Required("secretsmanager"+"."+"credentials", "body", m.Credentials); err != nil { - return err - } - - if m.Credentials != nil { - if err := m.Credentials.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("secretsmanager" + "." + "credentials") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("secretsmanager" + "." + "credentials") - } - return err - } - } - - return nil -} - -func (m *AwsConfigurationSecretsmanager) validateEndpoint(formats strfmt.Registry) error { - - if err := validate.Required("secretsmanager"+"."+"endpoint", "body", m.Endpoint); err != nil { - return err - } - - return nil -} - -func (m *AwsConfigurationSecretsmanager) validateRegion(formats strfmt.Registry) error { - - if err := validate.Required("secretsmanager"+"."+"region", "body", m.Region); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this aws configuration secretsmanager based on the context it is used -func (m *AwsConfigurationSecretsmanager) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateCredentials(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *AwsConfigurationSecretsmanager) contextValidateCredentials(ctx context.Context, formats strfmt.Registry) error { - - if m.Credentials != nil { - if err := m.Credentials.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("secretsmanager" + "." + "credentials") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("secretsmanager" + "." + "credentials") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *AwsConfigurationSecretsmanager) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *AwsConfigurationSecretsmanager) UnmarshalBinary(b []byte) error { - var res AwsConfigurationSecretsmanager - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// AwsConfigurationSecretsmanagerCredentials aws configuration secretsmanager credentials -// -// swagger:model AwsConfigurationSecretsmanagerCredentials -type AwsConfigurationSecretsmanagerCredentials struct { - - // accesskey - // Required: true - Accesskey *string `json:"accesskey"` - - // secretkey - // Required: true - Secretkey *string `json:"secretkey"` - - // token - Token string `json:"token,omitempty"` -} - -// Validate validates this aws configuration secretsmanager credentials -func (m *AwsConfigurationSecretsmanagerCredentials) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAccesskey(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSecretkey(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *AwsConfigurationSecretsmanagerCredentials) validateAccesskey(formats strfmt.Registry) error { - - if err := validate.Required("secretsmanager"+"."+"credentials"+"."+"accesskey", "body", m.Accesskey); err != nil { - return err - } - - return nil -} - -func (m *AwsConfigurationSecretsmanagerCredentials) validateSecretkey(formats strfmt.Registry) error { - - if err := validate.Required("secretsmanager"+"."+"credentials"+"."+"secretkey", "body", m.Secretkey); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this aws configuration secretsmanager credentials based on context it is used -func (m *AwsConfigurationSecretsmanagerCredentials) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *AwsConfigurationSecretsmanagerCredentials) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *AwsConfigurationSecretsmanagerCredentials) UnmarshalBinary(b []byte) error { - var res AwsConfigurationSecretsmanagerCredentials - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/azure_configuration.go b/models/azure_configuration.go deleted file mode 100644 index 7d2f97351..000000000 --- a/models/azure_configuration.go +++ /dev/null @@ -1,321 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// AzureConfiguration azure configuration -// -// swagger:model azureConfiguration -type AzureConfiguration struct { - - // keyvault - // Required: true - Keyvault *AzureConfigurationKeyvault `json:"keyvault"` -} - -// Validate validates this azure configuration -func (m *AzureConfiguration) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateKeyvault(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *AzureConfiguration) validateKeyvault(formats strfmt.Registry) error { - - if err := validate.Required("keyvault", "body", m.Keyvault); err != nil { - return err - } - - if m.Keyvault != nil { - if err := m.Keyvault.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keyvault") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("keyvault") - } - return err - } - } - - return nil -} - -// ContextValidate validate this azure configuration based on the context it is used -func (m *AzureConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateKeyvault(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *AzureConfiguration) contextValidateKeyvault(ctx context.Context, formats strfmt.Registry) error { - - if m.Keyvault != nil { - if err := m.Keyvault.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keyvault") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("keyvault") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *AzureConfiguration) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *AzureConfiguration) UnmarshalBinary(b []byte) error { - var res AzureConfiguration - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// AzureConfigurationKeyvault azure configuration keyvault -// -// swagger:model AzureConfigurationKeyvault -type AzureConfigurationKeyvault struct { - - // credentials - Credentials *AzureConfigurationKeyvaultCredentials `json:"credentials,omitempty"` - - // endpoint - // Required: true - Endpoint *string `json:"endpoint"` -} - -// Validate validates this azure configuration keyvault -func (m *AzureConfigurationKeyvault) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateCredentials(formats); err != nil { - res = append(res, err) - } - - if err := m.validateEndpoint(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *AzureConfigurationKeyvault) validateCredentials(formats strfmt.Registry) error { - if swag.IsZero(m.Credentials) { // not required - return nil - } - - if m.Credentials != nil { - if err := m.Credentials.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keyvault" + "." + "credentials") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("keyvault" + "." + "credentials") - } - return err - } - } - - return nil -} - -func (m *AzureConfigurationKeyvault) validateEndpoint(formats strfmt.Registry) error { - - if err := validate.Required("keyvault"+"."+"endpoint", "body", m.Endpoint); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this azure configuration keyvault based on the context it is used -func (m *AzureConfigurationKeyvault) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateCredentials(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *AzureConfigurationKeyvault) contextValidateCredentials(ctx context.Context, formats strfmt.Registry) error { - - if m.Credentials != nil { - if err := m.Credentials.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keyvault" + "." + "credentials") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("keyvault" + "." + "credentials") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *AzureConfigurationKeyvault) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *AzureConfigurationKeyvault) UnmarshalBinary(b []byte) error { - var res AzureConfigurationKeyvault - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// AzureConfigurationKeyvaultCredentials azure configuration keyvault credentials -// -// swagger:model AzureConfigurationKeyvaultCredentials -type AzureConfigurationKeyvaultCredentials struct { - - // client id - // Required: true - ClientID *string `json:"client_id"` - - // client secret - // Required: true - ClientSecret *string `json:"client_secret"` - - // tenant id - // Required: true - TenantID *string `json:"tenant_id"` -} - -// Validate validates this azure configuration keyvault credentials -func (m *AzureConfigurationKeyvaultCredentials) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateClientID(formats); err != nil { - res = append(res, err) - } - - if err := m.validateClientSecret(formats); err != nil { - res = append(res, err) - } - - if err := m.validateTenantID(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *AzureConfigurationKeyvaultCredentials) validateClientID(formats strfmt.Registry) error { - - if err := validate.Required("keyvault"+"."+"credentials"+"."+"client_id", "body", m.ClientID); err != nil { - return err - } - - return nil -} - -func (m *AzureConfigurationKeyvaultCredentials) validateClientSecret(formats strfmt.Registry) error { - - if err := validate.Required("keyvault"+"."+"credentials"+"."+"client_secret", "body", m.ClientSecret); err != nil { - return err - } - - return nil -} - -func (m *AzureConfigurationKeyvaultCredentials) validateTenantID(formats strfmt.Registry) error { - - if err := validate.Required("keyvault"+"."+"credentials"+"."+"tenant_id", "body", m.TenantID); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this azure configuration keyvault credentials based on context it is used -func (m *AzureConfigurationKeyvaultCredentials) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *AzureConfigurationKeyvaultCredentials) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *AzureConfigurationKeyvaultCredentials) UnmarshalBinary(b []byte) error { - var res AzureConfigurationKeyvaultCredentials - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/certificate_info.go b/models/certificate_info.go deleted file mode 100644 index dc084062b..000000000 --- a/models/certificate_info.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// CertificateInfo certificate info -// -// swagger:model certificateInfo -type CertificateInfo struct { - - // domains - Domains []string `json:"domains"` - - // expiry - Expiry string `json:"expiry,omitempty"` - - // name - Name string `json:"name,omitempty"` - - // serial number - SerialNumber string `json:"serialNumber,omitempty"` -} - -// Validate validates this certificate info -func (m *CertificateInfo) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this certificate info based on context it is used -func (m *CertificateInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *CertificateInfo) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *CertificateInfo) UnmarshalBinary(b []byte) error { - var res CertificateInfo - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/check_operator_version_response.go b/models/check_operator_version_response.go deleted file mode 100644 index c3bfc2871..000000000 --- a/models/check_operator_version_response.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// CheckOperatorVersionResponse check operator version response -// -// swagger:model checkOperatorVersionResponse -type CheckOperatorVersionResponse struct { - - // current version - CurrentVersion string `json:"current_version,omitempty"` - - // latest version - LatestVersion string `json:"latest_version,omitempty"` -} - -// Validate validates this check operator version response -func (m *CheckOperatorVersionResponse) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this check operator version response based on context it is used -func (m *CheckOperatorVersionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *CheckOperatorVersionResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *CheckOperatorVersionResponse) UnmarshalBinary(b []byte) error { - var res CheckOperatorVersionResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/condition.go b/models/condition.go deleted file mode 100644 index 8abdbdd76..000000000 --- a/models/condition.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// Condition condition -// -// swagger:model condition -type Condition struct { - - // status - Status string `json:"status,omitempty"` - - // type - Type string `json:"type,omitempty"` -} - -// Validate validates this condition -func (m *Condition) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this condition based on context it is used -func (m *Condition) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *Condition) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *Condition) UnmarshalBinary(b []byte) error { - var res Condition - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/config_map.go b/models/config_map.go deleted file mode 100644 index c796a0b16..000000000 --- a/models/config_map.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// ConfigMap config map -// -// swagger:model configMap -type ConfigMap struct { - - // name - Name string `json:"name,omitempty"` - - // optional - Optional bool `json:"optional,omitempty"` -} - -// Validate validates this config map -func (m *ConfigMap) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this config map based on context it is used -func (m *ConfigMap) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *ConfigMap) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ConfigMap) UnmarshalBinary(b []byte) error { - var res ConfigMap - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/configure_tenant_request.go b/models/configure_tenant_request.go deleted file mode 100644 index 5a6f04b5b..000000000 --- a/models/configure_tenant_request.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// ConfigureTenantRequest configure tenant request -// -// swagger:model configureTenantRequest -type ConfigureTenantRequest struct { - - // prometheus enabled - PrometheusEnabled bool `json:"prometheusEnabled,omitempty"` -} - -// Validate validates this configure tenant request -func (m *ConfigureTenantRequest) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this configure tenant request based on context it is used -func (m *ConfigureTenantRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *ConfigureTenantRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ConfigureTenantRequest) UnmarshalBinary(b []byte) error { - var res ConfigureTenantRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/container.go b/models/container.go deleted file mode 100644 index 537422077..000000000 --- a/models/container.go +++ /dev/null @@ -1,309 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// Container container -// -// swagger:model container -type Container struct { - - // args - Args []string `json:"args"` - - // container ID - ContainerID string `json:"containerID,omitempty"` - - // environment variables - EnvironmentVariables []*EnvironmentVariable `json:"environmentVariables"` - - // host ports - HostPorts []string `json:"hostPorts"` - - // image - Image string `json:"image,omitempty"` - - // image ID - ImageID string `json:"imageID,omitempty"` - - // last state - LastState *State `json:"lastState,omitempty"` - - // mounts - Mounts []*Mount `json:"mounts"` - - // name - Name string `json:"name,omitempty"` - - // ports - Ports []string `json:"ports"` - - // ready - Ready bool `json:"ready,omitempty"` - - // restart count - RestartCount int64 `json:"restartCount,omitempty"` - - // state - State *State `json:"state,omitempty"` -} - -// Validate validates this container -func (m *Container) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateEnvironmentVariables(formats); err != nil { - res = append(res, err) - } - - if err := m.validateLastState(formats); err != nil { - res = append(res, err) - } - - if err := m.validateMounts(formats); err != nil { - res = append(res, err) - } - - if err := m.validateState(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Container) validateEnvironmentVariables(formats strfmt.Registry) error { - if swag.IsZero(m.EnvironmentVariables) { // not required - return nil - } - - for i := 0; i < len(m.EnvironmentVariables); i++ { - if swag.IsZero(m.EnvironmentVariables[i]) { // not required - continue - } - - if m.EnvironmentVariables[i] != nil { - if err := m.EnvironmentVariables[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("environmentVariables" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("environmentVariables" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *Container) validateLastState(formats strfmt.Registry) error { - if swag.IsZero(m.LastState) { // not required - return nil - } - - if m.LastState != nil { - if err := m.LastState.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("lastState") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("lastState") - } - return err - } - } - - return nil -} - -func (m *Container) validateMounts(formats strfmt.Registry) error { - if swag.IsZero(m.Mounts) { // not required - return nil - } - - for i := 0; i < len(m.Mounts); i++ { - if swag.IsZero(m.Mounts[i]) { // not required - continue - } - - if m.Mounts[i] != nil { - if err := m.Mounts[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("mounts" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("mounts" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *Container) validateState(formats strfmt.Registry) error { - if swag.IsZero(m.State) { // not required - return nil - } - - if m.State != nil { - if err := m.State.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("state") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("state") - } - return err - } - } - - return nil -} - -// ContextValidate validate this container based on the context it is used -func (m *Container) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateEnvironmentVariables(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateLastState(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateMounts(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateState(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Container) contextValidateEnvironmentVariables(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.EnvironmentVariables); i++ { - - if m.EnvironmentVariables[i] != nil { - if err := m.EnvironmentVariables[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("environmentVariables" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("environmentVariables" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *Container) contextValidateLastState(ctx context.Context, formats strfmt.Registry) error { - - if m.LastState != nil { - if err := m.LastState.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("lastState") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("lastState") - } - return err - } - } - - return nil -} - -func (m *Container) contextValidateMounts(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Mounts); i++ { - - if m.Mounts[i] != nil { - if err := m.Mounts[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("mounts" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("mounts" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *Container) contextValidateState(ctx context.Context, formats strfmt.Registry) error { - - if m.State != nil { - if err := m.State.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("state") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("state") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *Container) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *Container) UnmarshalBinary(b []byte) error { - var res Container - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/create_tenant_request.go b/models/create_tenant_request.go deleted file mode 100644 index 81352ac35..000000000 --- a/models/create_tenant_request.go +++ /dev/null @@ -1,593 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// CreateTenantRequest create tenant request -// -// swagger:model createTenantRequest -type CreateTenantRequest struct { - - // access key - AccessKey string `json:"access_key,omitempty"` - - // annotations - Annotations map[string]string `json:"annotations,omitempty"` - - // domains - Domains *DomainsConfiguration `json:"domains,omitempty"` - - // enable console - EnableConsole *bool `json:"enable_console,omitempty"` - - // enable prometheus - EnablePrometheus *bool `json:"enable_prometheus,omitempty"` - - // enable tls - EnableTLS *bool `json:"enable_tls,omitempty"` - - // encryption - Encryption *EncryptionConfiguration `json:"encryption,omitempty"` - - // environment variables - EnvironmentVariables []*EnvironmentVariable `json:"environmentVariables"` - - // erasure coding parity - ErasureCodingParity int64 `json:"erasureCodingParity,omitempty"` - - // expose console - ExposeConsole bool `json:"expose_console,omitempty"` - - // expose minio - ExposeMinio bool `json:"expose_minio,omitempty"` - - // idp - Idp *IdpConfiguration `json:"idp,omitempty"` - - // image - Image string `json:"image,omitempty"` - - // image pull secret - ImagePullSecret string `json:"image_pull_secret,omitempty"` - - // image registry - ImageRegistry *ImageRegistry `json:"image_registry,omitempty"` - - // labels - Labels map[string]string `json:"labels,omitempty"` - - // log search configuration - LogSearchConfiguration *LogSearchConfiguration `json:"logSearchConfiguration,omitempty"` - - // mount path - MountPath string `json:"mount_path,omitempty"` - - // name - // Required: true - // Pattern: ^[a-z0-9-]{3,63}$ - Name *string `json:"name"` - - // namespace - // Required: true - Namespace *string `json:"namespace"` - - // pools - // Required: true - Pools []*Pool `json:"pools"` - - // prometheus configuration - PrometheusConfiguration *PrometheusConfiguration `json:"prometheusConfiguration,omitempty"` - - // secret key - SecretKey string `json:"secret_key,omitempty"` - - // tls - TLS *TLSConfiguration `json:"tls,omitempty"` -} - -// Validate validates this create tenant request -func (m *CreateTenantRequest) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateDomains(formats); err != nil { - res = append(res, err) - } - - if err := m.validateEncryption(formats); err != nil { - res = append(res, err) - } - - if err := m.validateEnvironmentVariables(formats); err != nil { - res = append(res, err) - } - - if err := m.validateIdp(formats); err != nil { - res = append(res, err) - } - - if err := m.validateImageRegistry(formats); err != nil { - res = append(res, err) - } - - if err := m.validateLogSearchConfiguration(formats); err != nil { - res = append(res, err) - } - - if err := m.validateName(formats); err != nil { - res = append(res, err) - } - - if err := m.validateNamespace(formats); err != nil { - res = append(res, err) - } - - if err := m.validatePools(formats); err != nil { - res = append(res, err) - } - - if err := m.validatePrometheusConfiguration(formats); err != nil { - res = append(res, err) - } - - if err := m.validateTLS(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *CreateTenantRequest) validateDomains(formats strfmt.Registry) error { - if swag.IsZero(m.Domains) { // not required - return nil - } - - if m.Domains != nil { - if err := m.Domains.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("domains") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("domains") - } - return err - } - } - - return nil -} - -func (m *CreateTenantRequest) validateEncryption(formats strfmt.Registry) error { - if swag.IsZero(m.Encryption) { // not required - return nil - } - - if m.Encryption != nil { - if err := m.Encryption.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("encryption") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("encryption") - } - return err - } - } - - return nil -} - -func (m *CreateTenantRequest) validateEnvironmentVariables(formats strfmt.Registry) error { - if swag.IsZero(m.EnvironmentVariables) { // not required - return nil - } - - for i := 0; i < len(m.EnvironmentVariables); i++ { - if swag.IsZero(m.EnvironmentVariables[i]) { // not required - continue - } - - if m.EnvironmentVariables[i] != nil { - if err := m.EnvironmentVariables[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("environmentVariables" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("environmentVariables" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *CreateTenantRequest) validateIdp(formats strfmt.Registry) error { - if swag.IsZero(m.Idp) { // not required - return nil - } - - if m.Idp != nil { - if err := m.Idp.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("idp") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("idp") - } - return err - } - } - - return nil -} - -func (m *CreateTenantRequest) validateImageRegistry(formats strfmt.Registry) error { - if swag.IsZero(m.ImageRegistry) { // not required - return nil - } - - if m.ImageRegistry != nil { - if err := m.ImageRegistry.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("image_registry") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("image_registry") - } - return err - } - } - - return nil -} - -func (m *CreateTenantRequest) validateLogSearchConfiguration(formats strfmt.Registry) error { - if swag.IsZero(m.LogSearchConfiguration) { // not required - return nil - } - - if m.LogSearchConfiguration != nil { - if err := m.LogSearchConfiguration.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("logSearchConfiguration") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("logSearchConfiguration") - } - return err - } - } - - return nil -} - -func (m *CreateTenantRequest) validateName(formats strfmt.Registry) error { - - if err := validate.Required("name", "body", m.Name); err != nil { - return err - } - - if err := validate.Pattern("name", "body", *m.Name, `^[a-z0-9-]{3,63}$`); err != nil { - return err - } - - return nil -} - -func (m *CreateTenantRequest) validateNamespace(formats strfmt.Registry) error { - - if err := validate.Required("namespace", "body", m.Namespace); err != nil { - return err - } - - return nil -} - -func (m *CreateTenantRequest) validatePools(formats strfmt.Registry) error { - - if err := validate.Required("pools", "body", m.Pools); err != nil { - return err - } - - for i := 0; i < len(m.Pools); i++ { - if swag.IsZero(m.Pools[i]) { // not required - continue - } - - if m.Pools[i] != nil { - if err := m.Pools[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("pools" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("pools" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *CreateTenantRequest) validatePrometheusConfiguration(formats strfmt.Registry) error { - if swag.IsZero(m.PrometheusConfiguration) { // not required - return nil - } - - if m.PrometheusConfiguration != nil { - if err := m.PrometheusConfiguration.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("prometheusConfiguration") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("prometheusConfiguration") - } - return err - } - } - - return nil -} - -func (m *CreateTenantRequest) validateTLS(formats strfmt.Registry) error { - if swag.IsZero(m.TLS) { // not required - return nil - } - - if m.TLS != nil { - if err := m.TLS.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("tls") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("tls") - } - return err - } - } - - return nil -} - -// ContextValidate validate this create tenant request based on the context it is used -func (m *CreateTenantRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateDomains(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateEncryption(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateEnvironmentVariables(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateIdp(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateImageRegistry(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateLogSearchConfiguration(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidatePools(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidatePrometheusConfiguration(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateTLS(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *CreateTenantRequest) contextValidateDomains(ctx context.Context, formats strfmt.Registry) error { - - if m.Domains != nil { - if err := m.Domains.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("domains") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("domains") - } - return err - } - } - - return nil -} - -func (m *CreateTenantRequest) contextValidateEncryption(ctx context.Context, formats strfmt.Registry) error { - - if m.Encryption != nil { - if err := m.Encryption.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("encryption") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("encryption") - } - return err - } - } - - return nil -} - -func (m *CreateTenantRequest) contextValidateEnvironmentVariables(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.EnvironmentVariables); i++ { - - if m.EnvironmentVariables[i] != nil { - if err := m.EnvironmentVariables[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("environmentVariables" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("environmentVariables" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *CreateTenantRequest) contextValidateIdp(ctx context.Context, formats strfmt.Registry) error { - - if m.Idp != nil { - if err := m.Idp.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("idp") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("idp") - } - return err - } - } - - return nil -} - -func (m *CreateTenantRequest) contextValidateImageRegistry(ctx context.Context, formats strfmt.Registry) error { - - if m.ImageRegistry != nil { - if err := m.ImageRegistry.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("image_registry") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("image_registry") - } - return err - } - } - - return nil -} - -func (m *CreateTenantRequest) contextValidateLogSearchConfiguration(ctx context.Context, formats strfmt.Registry) error { - - if m.LogSearchConfiguration != nil { - if err := m.LogSearchConfiguration.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("logSearchConfiguration") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("logSearchConfiguration") - } - return err - } - } - - return nil -} - -func (m *CreateTenantRequest) contextValidatePools(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Pools); i++ { - - if m.Pools[i] != nil { - if err := m.Pools[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("pools" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("pools" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *CreateTenantRequest) contextValidatePrometheusConfiguration(ctx context.Context, formats strfmt.Registry) error { - - if m.PrometheusConfiguration != nil { - if err := m.PrometheusConfiguration.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("prometheusConfiguration") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("prometheusConfiguration") - } - return err - } - } - - return nil -} - -func (m *CreateTenantRequest) contextValidateTLS(ctx context.Context, formats strfmt.Registry) error { - - if m.TLS != nil { - if err := m.TLS.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("tls") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("tls") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *CreateTenantRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *CreateTenantRequest) UnmarshalBinary(b []byte) error { - var res CreateTenantRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/create_tenant_response.go b/models/create_tenant_response.go deleted file mode 100644 index fbbcb6bf2..000000000 --- a/models/create_tenant_response.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// CreateTenantResponse create tenant response -// -// swagger:model createTenantResponse -type CreateTenantResponse struct { - - // console - Console []*TenantResponseItem `json:"console"` - - // external ID p - ExternalIDP bool `json:"externalIDP,omitempty"` -} - -// Validate validates this create tenant response -func (m *CreateTenantResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateConsole(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *CreateTenantResponse) validateConsole(formats strfmt.Registry) error { - if swag.IsZero(m.Console) { // not required - return nil - } - - for i := 0; i < len(m.Console); i++ { - if swag.IsZero(m.Console[i]) { // not required - continue - } - - if m.Console[i] != nil { - if err := m.Console[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("console" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("console" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this create tenant response based on the context it is used -func (m *CreateTenantResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateConsole(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *CreateTenantResponse) contextValidateConsole(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Console); i++ { - - if m.Console[i] != nil { - if err := m.Console[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("console" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("console" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *CreateTenantResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *CreateTenantResponse) UnmarshalBinary(b []byte) error { - var res CreateTenantResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/csr_element.go b/models/csr_element.go deleted file mode 100644 index d4a6d3b63..000000000 --- a/models/csr_element.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// CsrElement csr element -// -// swagger:model csrElement -type CsrElement struct { - - // annotations - Annotations []*Annotation `json:"annotations"` - - // deletion grace period seconds - DeletionGracePeriodSeconds int64 `json:"deletion_grace_period_seconds,omitempty"` - - // generate name - GenerateName string `json:"generate_name,omitempty"` - - // generation - Generation int64 `json:"generation,omitempty"` - - // name - Name string `json:"name,omitempty"` - - // namespace - Namespace string `json:"namespace,omitempty"` - - // resource version - ResourceVersion string `json:"resource_version,omitempty"` - - // status - Status string `json:"status,omitempty"` -} - -// Validate validates this csr element -func (m *CsrElement) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAnnotations(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *CsrElement) validateAnnotations(formats strfmt.Registry) error { - if swag.IsZero(m.Annotations) { // not required - return nil - } - - for i := 0; i < len(m.Annotations); i++ { - if swag.IsZero(m.Annotations[i]) { // not required - continue - } - - if m.Annotations[i] != nil { - if err := m.Annotations[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("annotations" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("annotations" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this csr element based on the context it is used -func (m *CsrElement) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateAnnotations(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *CsrElement) contextValidateAnnotations(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Annotations); i++ { - - if m.Annotations[i] != nil { - if err := m.Annotations[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("annotations" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("annotations" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *CsrElement) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *CsrElement) UnmarshalBinary(b []byte) error { - var res CsrElement - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/csr_elements.go b/models/csr_elements.go deleted file mode 100644 index b780eadcb..000000000 --- a/models/csr_elements.go +++ /dev/null @@ -1,133 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// CsrElements csr elements -// -// swagger:model csrElements -type CsrElements struct { - - // csr element - CsrElement []*CsrElement `json:"csrElement"` -} - -// Validate validates this csr elements -func (m *CsrElements) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateCsrElement(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *CsrElements) validateCsrElement(formats strfmt.Registry) error { - if swag.IsZero(m.CsrElement) { // not required - return nil - } - - for i := 0; i < len(m.CsrElement); i++ { - if swag.IsZero(m.CsrElement[i]) { // not required - continue - } - - if m.CsrElement[i] != nil { - if err := m.CsrElement[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("csrElement" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("csrElement" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this csr elements based on the context it is used -func (m *CsrElements) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateCsrElement(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *CsrElements) contextValidateCsrElement(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.CsrElement); i++ { - - if m.CsrElement[i] != nil { - if err := m.CsrElement[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("csrElement" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("csrElement" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *CsrElements) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *CsrElements) UnmarshalBinary(b []byte) error { - var res CsrElements - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/delete_tenant_request.go b/models/delete_tenant_request.go deleted file mode 100644 index f3da4b66f..000000000 --- a/models/delete_tenant_request.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// DeleteTenantRequest delete tenant request -// -// swagger:model deleteTenantRequest -type DeleteTenantRequest struct { - - // delete pvcs - DeletePvcs bool `json:"delete_pvcs,omitempty"` -} - -// Validate validates this delete tenant request -func (m *DeleteTenantRequest) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this delete tenant request based on context it is used -func (m *DeleteTenantRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *DeleteTenantRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *DeleteTenantRequest) UnmarshalBinary(b []byte) error { - var res DeleteTenantRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/describe_p_v_c_wrapper.go b/models/describe_p_v_c_wrapper.go deleted file mode 100644 index 77cc4a97f..000000000 --- a/models/describe_p_v_c_wrapper.go +++ /dev/null @@ -1,217 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// DescribePVCWrapper describe p v c wrapper -// -// swagger:model describePVCWrapper -type DescribePVCWrapper struct { - - // access modes - AccessModes []string `json:"accessModes"` - - // annotations - Annotations []*Annotation `json:"annotations"` - - // capacity - Capacity string `json:"capacity,omitempty"` - - // finalizers - Finalizers []string `json:"finalizers"` - - // labels - Labels []*Label `json:"labels"` - - // name - Name string `json:"name,omitempty"` - - // namespace - Namespace string `json:"namespace,omitempty"` - - // status - Status string `json:"status,omitempty"` - - // storage class - StorageClass string `json:"storageClass,omitempty"` - - // volume - Volume string `json:"volume,omitempty"` - - // volume mode - VolumeMode string `json:"volumeMode,omitempty"` -} - -// Validate validates this describe p v c wrapper -func (m *DescribePVCWrapper) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAnnotations(formats); err != nil { - res = append(res, err) - } - - if err := m.validateLabels(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *DescribePVCWrapper) validateAnnotations(formats strfmt.Registry) error { - if swag.IsZero(m.Annotations) { // not required - return nil - } - - for i := 0; i < len(m.Annotations); i++ { - if swag.IsZero(m.Annotations[i]) { // not required - continue - } - - if m.Annotations[i] != nil { - if err := m.Annotations[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("annotations" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("annotations" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *DescribePVCWrapper) validateLabels(formats strfmt.Registry) error { - if swag.IsZero(m.Labels) { // not required - return nil - } - - for i := 0; i < len(m.Labels); i++ { - if swag.IsZero(m.Labels[i]) { // not required - continue - } - - if m.Labels[i] != nil { - if err := m.Labels[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("labels" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("labels" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this describe p v c wrapper based on the context it is used -func (m *DescribePVCWrapper) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateAnnotations(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateLabels(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *DescribePVCWrapper) contextValidateAnnotations(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Annotations); i++ { - - if m.Annotations[i] != nil { - if err := m.Annotations[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("annotations" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("annotations" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *DescribePVCWrapper) contextValidateLabels(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Labels); i++ { - - if m.Labels[i] != nil { - if err := m.Labels[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("labels" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("labels" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *DescribePVCWrapper) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *DescribePVCWrapper) UnmarshalBinary(b []byte) error { - var res DescribePVCWrapper - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/describe_pod_wrapper.go b/models/describe_pod_wrapper.go deleted file mode 100644 index 6856ae14d..000000000 --- a/models/describe_pod_wrapper.go +++ /dev/null @@ -1,517 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// DescribePodWrapper describe pod wrapper -// -// swagger:model describePodWrapper -type DescribePodWrapper struct { - - // annotations - Annotations []*Annotation `json:"annotations"` - - // conditions - Conditions []*Condition `json:"conditions"` - - // containers - Containers []*Container `json:"containers"` - - // controller ref - ControllerRef string `json:"controllerRef,omitempty"` - - // deletion grace period seconds - DeletionGracePeriodSeconds int64 `json:"deletionGracePeriodSeconds,omitempty"` - - // deletion timestamp - DeletionTimestamp string `json:"deletionTimestamp,omitempty"` - - // labels - Labels []*Label `json:"labels"` - - // message - Message string `json:"message,omitempty"` - - // name - Name string `json:"name,omitempty"` - - // namespace - Namespace string `json:"namespace,omitempty"` - - // node name - NodeName string `json:"nodeName,omitempty"` - - // node selector - NodeSelector []*NodeSelector `json:"nodeSelector"` - - // phase - Phase string `json:"phase,omitempty"` - - // pod IP - PodIP string `json:"podIP,omitempty"` - - // priority - Priority int64 `json:"priority,omitempty"` - - // priority class name - PriorityClassName string `json:"priorityClassName,omitempty"` - - // qos class - QosClass string `json:"qosClass,omitempty"` - - // reason - Reason string `json:"reason,omitempty"` - - // start time - StartTime string `json:"startTime,omitempty"` - - // tolerations - Tolerations []*Toleration `json:"tolerations"` - - // volumes - Volumes []*Volume `json:"volumes"` -} - -// Validate validates this describe pod wrapper -func (m *DescribePodWrapper) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAnnotations(formats); err != nil { - res = append(res, err) - } - - if err := m.validateConditions(formats); err != nil { - res = append(res, err) - } - - if err := m.validateContainers(formats); err != nil { - res = append(res, err) - } - - if err := m.validateLabels(formats); err != nil { - res = append(res, err) - } - - if err := m.validateNodeSelector(formats); err != nil { - res = append(res, err) - } - - if err := m.validateTolerations(formats); err != nil { - res = append(res, err) - } - - if err := m.validateVolumes(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *DescribePodWrapper) validateAnnotations(formats strfmt.Registry) error { - if swag.IsZero(m.Annotations) { // not required - return nil - } - - for i := 0; i < len(m.Annotations); i++ { - if swag.IsZero(m.Annotations[i]) { // not required - continue - } - - if m.Annotations[i] != nil { - if err := m.Annotations[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("annotations" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("annotations" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *DescribePodWrapper) validateConditions(formats strfmt.Registry) error { - if swag.IsZero(m.Conditions) { // not required - return nil - } - - for i := 0; i < len(m.Conditions); i++ { - if swag.IsZero(m.Conditions[i]) { // not required - continue - } - - if m.Conditions[i] != nil { - if err := m.Conditions[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("conditions" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("conditions" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *DescribePodWrapper) validateContainers(formats strfmt.Registry) error { - if swag.IsZero(m.Containers) { // not required - return nil - } - - for i := 0; i < len(m.Containers); i++ { - if swag.IsZero(m.Containers[i]) { // not required - continue - } - - if m.Containers[i] != nil { - if err := m.Containers[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("containers" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("containers" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *DescribePodWrapper) validateLabels(formats strfmt.Registry) error { - if swag.IsZero(m.Labels) { // not required - return nil - } - - for i := 0; i < len(m.Labels); i++ { - if swag.IsZero(m.Labels[i]) { // not required - continue - } - - if m.Labels[i] != nil { - if err := m.Labels[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("labels" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("labels" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *DescribePodWrapper) validateNodeSelector(formats strfmt.Registry) error { - if swag.IsZero(m.NodeSelector) { // not required - return nil - } - - for i := 0; i < len(m.NodeSelector); i++ { - if swag.IsZero(m.NodeSelector[i]) { // not required - continue - } - - if m.NodeSelector[i] != nil { - if err := m.NodeSelector[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("nodeSelector" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("nodeSelector" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *DescribePodWrapper) validateTolerations(formats strfmt.Registry) error { - if swag.IsZero(m.Tolerations) { // not required - return nil - } - - for i := 0; i < len(m.Tolerations); i++ { - if swag.IsZero(m.Tolerations[i]) { // not required - continue - } - - if m.Tolerations[i] != nil { - if err := m.Tolerations[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("tolerations" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("tolerations" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *DescribePodWrapper) validateVolumes(formats strfmt.Registry) error { - if swag.IsZero(m.Volumes) { // not required - return nil - } - - for i := 0; i < len(m.Volumes); i++ { - if swag.IsZero(m.Volumes[i]) { // not required - continue - } - - if m.Volumes[i] != nil { - if err := m.Volumes[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("volumes" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("volumes" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this describe pod wrapper based on the context it is used -func (m *DescribePodWrapper) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateAnnotations(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateConditions(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateContainers(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateLabels(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateNodeSelector(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateTolerations(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateVolumes(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *DescribePodWrapper) contextValidateAnnotations(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Annotations); i++ { - - if m.Annotations[i] != nil { - if err := m.Annotations[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("annotations" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("annotations" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *DescribePodWrapper) contextValidateConditions(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Conditions); i++ { - - if m.Conditions[i] != nil { - if err := m.Conditions[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("conditions" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("conditions" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *DescribePodWrapper) contextValidateContainers(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Containers); i++ { - - if m.Containers[i] != nil { - if err := m.Containers[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("containers" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("containers" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *DescribePodWrapper) contextValidateLabels(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Labels); i++ { - - if m.Labels[i] != nil { - if err := m.Labels[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("labels" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("labels" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *DescribePodWrapper) contextValidateNodeSelector(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.NodeSelector); i++ { - - if m.NodeSelector[i] != nil { - if err := m.NodeSelector[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("nodeSelector" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("nodeSelector" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *DescribePodWrapper) contextValidateTolerations(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Tolerations); i++ { - - if m.Tolerations[i] != nil { - if err := m.Tolerations[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("tolerations" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("tolerations" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *DescribePodWrapper) contextValidateVolumes(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Volumes); i++ { - - if m.Volumes[i] != nil { - if err := m.Volumes[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("volumes" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("volumes" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *DescribePodWrapper) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *DescribePodWrapper) UnmarshalBinary(b []byte) error { - var res DescribePodWrapper - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/direct_p_v_drive_info.go b/models/direct_p_v_drive_info.go deleted file mode 100644 index 36267d5b2..000000000 --- a/models/direct_p_v_drive_info.go +++ /dev/null @@ -1,85 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// DirectPVDriveInfo direct p v drive info -// -// swagger:model directPVDriveInfo -type DirectPVDriveInfo struct { - - // allocated - Allocated int64 `json:"allocated,omitempty"` - - // capacity - Capacity int64 `json:"capacity,omitempty"` - - // drive - Drive string `json:"drive,omitempty"` - - // message - Message string `json:"message,omitempty"` - - // node - Node string `json:"node,omitempty"` - - // status - Status string `json:"status,omitempty"` - - // volumes - Volumes int64 `json:"volumes,omitempty"` -} - -// Validate validates this direct p v drive info -func (m *DirectPVDriveInfo) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this direct p v drive info based on context it is used -func (m *DirectPVDriveInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *DirectPVDriveInfo) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *DirectPVDriveInfo) UnmarshalBinary(b []byte) error { - var res DirectPVDriveInfo - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/direct_p_v_volume_info.go b/models/direct_p_v_volume_info.go deleted file mode 100644 index d2c0d3f36..000000000 --- a/models/direct_p_v_volume_info.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// DirectPVVolumeInfo direct p v volume info -// -// swagger:model directPVVolumeInfo -type DirectPVVolumeInfo struct { - - // capacity - Capacity int64 `json:"capacity,omitempty"` - - // drive - Drive string `json:"drive,omitempty"` - - // node - Node string `json:"node,omitempty"` - - // volume - Volume string `json:"volume,omitempty"` -} - -// Validate validates this direct p v volume info -func (m *DirectPVVolumeInfo) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this direct p v volume info based on context it is used -func (m *DirectPVVolumeInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *DirectPVVolumeInfo) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *DirectPVVolumeInfo) UnmarshalBinary(b []byte) error { - var res DirectPVVolumeInfo - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/domains_configuration.go b/models/domains_configuration.go deleted file mode 100644 index f82316e68..000000000 --- a/models/domains_configuration.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// DomainsConfiguration domains configuration -// -// swagger:model domainsConfiguration -type DomainsConfiguration struct { - - // console - Console string `json:"console,omitempty"` - - // minio - Minio []string `json:"minio"` -} - -// Validate validates this domains configuration -func (m *DomainsConfiguration) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this domains configuration based on context it is used -func (m *DomainsConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *DomainsConfiguration) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *DomainsConfiguration) UnmarshalBinary(b []byte) error { - var res DomainsConfiguration - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/encryption_configuration.go b/models/encryption_configuration.go deleted file mode 100644 index 792eb532d..000000000 --- a/models/encryption_configuration.go +++ /dev/null @@ -1,705 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// EncryptionConfiguration encryption configuration -// -// swagger:model encryptionConfiguration -type EncryptionConfiguration struct { - MetadataFields - - // aws - Aws *AwsConfiguration `json:"aws,omitempty"` - - // azure - Azure *AzureConfiguration `json:"azure,omitempty"` - - // gcp - Gcp *GcpConfiguration `json:"gcp,omitempty"` - - // gemalto - Gemalto *GemaltoConfiguration `json:"gemalto,omitempty"` - - // image - Image string `json:"image,omitempty"` - - // kms mtls - KmsMtls *EncryptionConfigurationAO1KmsMtls `json:"kms_mtls,omitempty"` - - // minio mtls - MinioMtls *KeyPairConfiguration `json:"minio_mtls,omitempty"` - - // raw - Raw string `json:"raw,omitempty"` - - // replicas - Replicas string `json:"replicas,omitempty"` - - // secrets to be deleted - SecretsToBeDeleted []string `json:"secretsToBeDeleted"` - - // security context - SecurityContext *SecurityContext `json:"securityContext,omitempty"` - - // server tls - ServerTLS *KeyPairConfiguration `json:"server_tls,omitempty"` - - // vault - Vault *VaultConfiguration `json:"vault,omitempty"` -} - -// UnmarshalJSON unmarshals this object from a JSON structure -func (m *EncryptionConfiguration) UnmarshalJSON(raw []byte) error { - // AO0 - var aO0 MetadataFields - if err := swag.ReadJSON(raw, &aO0); err != nil { - return err - } - m.MetadataFields = aO0 - - // AO1 - var dataAO1 struct { - Aws *AwsConfiguration `json:"aws,omitempty"` - - Azure *AzureConfiguration `json:"azure,omitempty"` - - Gcp *GcpConfiguration `json:"gcp,omitempty"` - - Gemalto *GemaltoConfiguration `json:"gemalto,omitempty"` - - Image string `json:"image,omitempty"` - - KmsMtls *EncryptionConfigurationAO1KmsMtls `json:"kms_mtls,omitempty"` - - MinioMtls *KeyPairConfiguration `json:"minio_mtls,omitempty"` - - Raw string `json:"raw,omitempty"` - - Replicas string `json:"replicas,omitempty"` - - SecretsToBeDeleted []string `json:"secretsToBeDeleted"` - - SecurityContext *SecurityContext `json:"securityContext,omitempty"` - - ServerTLS *KeyPairConfiguration `json:"server_tls,omitempty"` - - Vault *VaultConfiguration `json:"vault,omitempty"` - } - if err := swag.ReadJSON(raw, &dataAO1); err != nil { - return err - } - - m.Aws = dataAO1.Aws - - m.Azure = dataAO1.Azure - - m.Gcp = dataAO1.Gcp - - m.Gemalto = dataAO1.Gemalto - - m.Image = dataAO1.Image - - m.KmsMtls = dataAO1.KmsMtls - - m.MinioMtls = dataAO1.MinioMtls - - m.Raw = dataAO1.Raw - - m.Replicas = dataAO1.Replicas - - m.SecretsToBeDeleted = dataAO1.SecretsToBeDeleted - - m.SecurityContext = dataAO1.SecurityContext - - m.ServerTLS = dataAO1.ServerTLS - - m.Vault = dataAO1.Vault - - return nil -} - -// MarshalJSON marshals this object to a JSON structure -func (m EncryptionConfiguration) MarshalJSON() ([]byte, error) { - _parts := make([][]byte, 0, 2) - - aO0, err := swag.WriteJSON(m.MetadataFields) - if err != nil { - return nil, err - } - _parts = append(_parts, aO0) - var dataAO1 struct { - Aws *AwsConfiguration `json:"aws,omitempty"` - - Azure *AzureConfiguration `json:"azure,omitempty"` - - Gcp *GcpConfiguration `json:"gcp,omitempty"` - - Gemalto *GemaltoConfiguration `json:"gemalto,omitempty"` - - Image string `json:"image,omitempty"` - - KmsMtls *EncryptionConfigurationAO1KmsMtls `json:"kms_mtls,omitempty"` - - MinioMtls *KeyPairConfiguration `json:"minio_mtls,omitempty"` - - Raw string `json:"raw,omitempty"` - - Replicas string `json:"replicas,omitempty"` - - SecretsToBeDeleted []string `json:"secretsToBeDeleted"` - - SecurityContext *SecurityContext `json:"securityContext,omitempty"` - - ServerTLS *KeyPairConfiguration `json:"server_tls,omitempty"` - - Vault *VaultConfiguration `json:"vault,omitempty"` - } - - dataAO1.Aws = m.Aws - - dataAO1.Azure = m.Azure - - dataAO1.Gcp = m.Gcp - - dataAO1.Gemalto = m.Gemalto - - dataAO1.Image = m.Image - - dataAO1.KmsMtls = m.KmsMtls - - dataAO1.MinioMtls = m.MinioMtls - - dataAO1.Raw = m.Raw - - dataAO1.Replicas = m.Replicas - - dataAO1.SecretsToBeDeleted = m.SecretsToBeDeleted - - dataAO1.SecurityContext = m.SecurityContext - - dataAO1.ServerTLS = m.ServerTLS - - dataAO1.Vault = m.Vault - - jsonDataAO1, errAO1 := swag.WriteJSON(dataAO1) - if errAO1 != nil { - return nil, errAO1 - } - _parts = append(_parts, jsonDataAO1) - return swag.ConcatJSON(_parts...), nil -} - -// Validate validates this encryption configuration -func (m *EncryptionConfiguration) Validate(formats strfmt.Registry) error { - var res []error - - // validation for a type composition with MetadataFields - if err := m.MetadataFields.Validate(formats); err != nil { - res = append(res, err) - } - - if err := m.validateAws(formats); err != nil { - res = append(res, err) - } - - if err := m.validateAzure(formats); err != nil { - res = append(res, err) - } - - if err := m.validateGcp(formats); err != nil { - res = append(res, err) - } - - if err := m.validateGemalto(formats); err != nil { - res = append(res, err) - } - - if err := m.validateKmsMtls(formats); err != nil { - res = append(res, err) - } - - if err := m.validateMinioMtls(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSecurityContext(formats); err != nil { - res = append(res, err) - } - - if err := m.validateServerTLS(formats); err != nil { - res = append(res, err) - } - - if err := m.validateVault(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *EncryptionConfiguration) validateAws(formats strfmt.Registry) error { - - if swag.IsZero(m.Aws) { // not required - return nil - } - - if m.Aws != nil { - if err := m.Aws.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("aws") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("aws") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfiguration) validateAzure(formats strfmt.Registry) error { - - if swag.IsZero(m.Azure) { // not required - return nil - } - - if m.Azure != nil { - if err := m.Azure.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("azure") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("azure") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfiguration) validateGcp(formats strfmt.Registry) error { - - if swag.IsZero(m.Gcp) { // not required - return nil - } - - if m.Gcp != nil { - if err := m.Gcp.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gcp") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("gcp") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfiguration) validateGemalto(formats strfmt.Registry) error { - - if swag.IsZero(m.Gemalto) { // not required - return nil - } - - if m.Gemalto != nil { - if err := m.Gemalto.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gemalto") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("gemalto") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfiguration) validateKmsMtls(formats strfmt.Registry) error { - - if swag.IsZero(m.KmsMtls) { // not required - return nil - } - - if m.KmsMtls != nil { - if err := m.KmsMtls.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("kms_mtls") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("kms_mtls") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfiguration) validateMinioMtls(formats strfmt.Registry) error { - - if swag.IsZero(m.MinioMtls) { // not required - return nil - } - - if m.MinioMtls != nil { - if err := m.MinioMtls.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("minio_mtls") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("minio_mtls") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfiguration) validateSecurityContext(formats strfmt.Registry) error { - - if swag.IsZero(m.SecurityContext) { // not required - return nil - } - - if m.SecurityContext != nil { - if err := m.SecurityContext.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("securityContext") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfiguration) validateServerTLS(formats strfmt.Registry) error { - - if swag.IsZero(m.ServerTLS) { // not required - return nil - } - - if m.ServerTLS != nil { - if err := m.ServerTLS.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("server_tls") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("server_tls") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfiguration) validateVault(formats strfmt.Registry) error { - - if swag.IsZero(m.Vault) { // not required - return nil - } - - if m.Vault != nil { - if err := m.Vault.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("vault") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("vault") - } - return err - } - } - - return nil -} - -// ContextValidate validate this encryption configuration based on the context it is used -func (m *EncryptionConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - // validation for a type composition with MetadataFields - if err := m.MetadataFields.ContextValidate(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateAws(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateAzure(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateGcp(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateGemalto(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateKmsMtls(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateMinioMtls(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateSecurityContext(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateServerTLS(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateVault(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *EncryptionConfiguration) contextValidateAws(ctx context.Context, formats strfmt.Registry) error { - - if m.Aws != nil { - if err := m.Aws.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("aws") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("aws") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfiguration) contextValidateAzure(ctx context.Context, formats strfmt.Registry) error { - - if m.Azure != nil { - if err := m.Azure.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("azure") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("azure") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfiguration) contextValidateGcp(ctx context.Context, formats strfmt.Registry) error { - - if m.Gcp != nil { - if err := m.Gcp.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gcp") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("gcp") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfiguration) contextValidateGemalto(ctx context.Context, formats strfmt.Registry) error { - - if m.Gemalto != nil { - if err := m.Gemalto.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gemalto") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("gemalto") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfiguration) contextValidateKmsMtls(ctx context.Context, formats strfmt.Registry) error { - - if m.KmsMtls != nil { - if err := m.KmsMtls.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("kms_mtls") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("kms_mtls") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfiguration) contextValidateMinioMtls(ctx context.Context, formats strfmt.Registry) error { - - if m.MinioMtls != nil { - if err := m.MinioMtls.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("minio_mtls") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("minio_mtls") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfiguration) contextValidateSecurityContext(ctx context.Context, formats strfmt.Registry) error { - - if m.SecurityContext != nil { - if err := m.SecurityContext.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("securityContext") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfiguration) contextValidateServerTLS(ctx context.Context, formats strfmt.Registry) error { - - if m.ServerTLS != nil { - if err := m.ServerTLS.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("server_tls") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("server_tls") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfiguration) contextValidateVault(ctx context.Context, formats strfmt.Registry) error { - - if m.Vault != nil { - if err := m.Vault.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("vault") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("vault") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *EncryptionConfiguration) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *EncryptionConfiguration) UnmarshalBinary(b []byte) error { - var res EncryptionConfiguration - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// EncryptionConfigurationAO1KmsMtls encryption configuration a o1 kms mtls -// -// swagger:model EncryptionConfigurationAO1KmsMtls -type EncryptionConfigurationAO1KmsMtls struct { - - // ca - Ca string `json:"ca,omitempty"` - - // crt - Crt string `json:"crt,omitempty"` - - // key - Key string `json:"key,omitempty"` -} - -// Validate validates this encryption configuration a o1 kms mtls -func (m *EncryptionConfigurationAO1KmsMtls) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this encryption configuration a o1 kms mtls based on context it is used -func (m *EncryptionConfigurationAO1KmsMtls) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *EncryptionConfigurationAO1KmsMtls) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *EncryptionConfigurationAO1KmsMtls) UnmarshalBinary(b []byte) error { - var res EncryptionConfigurationAO1KmsMtls - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/encryption_configuration_response.go b/models/encryption_configuration_response.go deleted file mode 100644 index bc76f78e4..000000000 --- a/models/encryption_configuration_response.go +++ /dev/null @@ -1,787 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// EncryptionConfigurationResponse encryption configuration response -// -// swagger:model encryptionConfigurationResponse -type EncryptionConfigurationResponse struct { - MetadataFields - - // aws - Aws *AwsConfiguration `json:"aws,omitempty"` - - // azure - Azure *AzureConfiguration `json:"azure,omitempty"` - - // gcp - Gcp *GcpConfiguration `json:"gcp,omitempty"` - - // gemalto - Gemalto *GemaltoConfigurationResponse `json:"gemalto,omitempty"` - - // image - Image string `json:"image,omitempty"` - - // kms mtls - KmsMtls *EncryptionConfigurationResponseAO1KmsMtls `json:"kms_mtls,omitempty"` - - // minio mtls - MinioMtls *CertificateInfo `json:"minio_mtls,omitempty"` - - // raw - Raw string `json:"raw,omitempty"` - - // replicas - Replicas string `json:"replicas,omitempty"` - - // security context - SecurityContext *SecurityContext `json:"securityContext,omitempty"` - - // server tls - ServerTLS *CertificateInfo `json:"server_tls,omitempty"` - - // vault - Vault *VaultConfigurationResponse `json:"vault,omitempty"` -} - -// UnmarshalJSON unmarshals this object from a JSON structure -func (m *EncryptionConfigurationResponse) UnmarshalJSON(raw []byte) error { - // AO0 - var aO0 MetadataFields - if err := swag.ReadJSON(raw, &aO0); err != nil { - return err - } - m.MetadataFields = aO0 - - // AO1 - var dataAO1 struct { - Aws *AwsConfiguration `json:"aws,omitempty"` - - Azure *AzureConfiguration `json:"azure,omitempty"` - - Gcp *GcpConfiguration `json:"gcp,omitempty"` - - Gemalto *GemaltoConfigurationResponse `json:"gemalto,omitempty"` - - Image string `json:"image,omitempty"` - - KmsMtls *EncryptionConfigurationResponseAO1KmsMtls `json:"kms_mtls,omitempty"` - - MinioMtls *CertificateInfo `json:"minio_mtls,omitempty"` - - Raw string `json:"raw,omitempty"` - - Replicas string `json:"replicas,omitempty"` - - SecurityContext *SecurityContext `json:"securityContext,omitempty"` - - ServerTLS *CertificateInfo `json:"server_tls,omitempty"` - - Vault *VaultConfigurationResponse `json:"vault,omitempty"` - } - if err := swag.ReadJSON(raw, &dataAO1); err != nil { - return err - } - - m.Aws = dataAO1.Aws - - m.Azure = dataAO1.Azure - - m.Gcp = dataAO1.Gcp - - m.Gemalto = dataAO1.Gemalto - - m.Image = dataAO1.Image - - m.KmsMtls = dataAO1.KmsMtls - - m.MinioMtls = dataAO1.MinioMtls - - m.Raw = dataAO1.Raw - - m.Replicas = dataAO1.Replicas - - m.SecurityContext = dataAO1.SecurityContext - - m.ServerTLS = dataAO1.ServerTLS - - m.Vault = dataAO1.Vault - - return nil -} - -// MarshalJSON marshals this object to a JSON structure -func (m EncryptionConfigurationResponse) MarshalJSON() ([]byte, error) { - _parts := make([][]byte, 0, 2) - - aO0, err := swag.WriteJSON(m.MetadataFields) - if err != nil { - return nil, err - } - _parts = append(_parts, aO0) - var dataAO1 struct { - Aws *AwsConfiguration `json:"aws,omitempty"` - - Azure *AzureConfiguration `json:"azure,omitempty"` - - Gcp *GcpConfiguration `json:"gcp,omitempty"` - - Gemalto *GemaltoConfigurationResponse `json:"gemalto,omitempty"` - - Image string `json:"image,omitempty"` - - KmsMtls *EncryptionConfigurationResponseAO1KmsMtls `json:"kms_mtls,omitempty"` - - MinioMtls *CertificateInfo `json:"minio_mtls,omitempty"` - - Raw string `json:"raw,omitempty"` - - Replicas string `json:"replicas,omitempty"` - - SecurityContext *SecurityContext `json:"securityContext,omitempty"` - - ServerTLS *CertificateInfo `json:"server_tls,omitempty"` - - Vault *VaultConfigurationResponse `json:"vault,omitempty"` - } - - dataAO1.Aws = m.Aws - - dataAO1.Azure = m.Azure - - dataAO1.Gcp = m.Gcp - - dataAO1.Gemalto = m.Gemalto - - dataAO1.Image = m.Image - - dataAO1.KmsMtls = m.KmsMtls - - dataAO1.MinioMtls = m.MinioMtls - - dataAO1.Raw = m.Raw - - dataAO1.Replicas = m.Replicas - - dataAO1.SecurityContext = m.SecurityContext - - dataAO1.ServerTLS = m.ServerTLS - - dataAO1.Vault = m.Vault - - jsonDataAO1, errAO1 := swag.WriteJSON(dataAO1) - if errAO1 != nil { - return nil, errAO1 - } - _parts = append(_parts, jsonDataAO1) - return swag.ConcatJSON(_parts...), nil -} - -// Validate validates this encryption configuration response -func (m *EncryptionConfigurationResponse) Validate(formats strfmt.Registry) error { - var res []error - - // validation for a type composition with MetadataFields - if err := m.MetadataFields.Validate(formats); err != nil { - res = append(res, err) - } - - if err := m.validateAws(formats); err != nil { - res = append(res, err) - } - - if err := m.validateAzure(formats); err != nil { - res = append(res, err) - } - - if err := m.validateGcp(formats); err != nil { - res = append(res, err) - } - - if err := m.validateGemalto(formats); err != nil { - res = append(res, err) - } - - if err := m.validateKmsMtls(formats); err != nil { - res = append(res, err) - } - - if err := m.validateMinioMtls(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSecurityContext(formats); err != nil { - res = append(res, err) - } - - if err := m.validateServerTLS(formats); err != nil { - res = append(res, err) - } - - if err := m.validateVault(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *EncryptionConfigurationResponse) validateAws(formats strfmt.Registry) error { - - if swag.IsZero(m.Aws) { // not required - return nil - } - - if m.Aws != nil { - if err := m.Aws.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("aws") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("aws") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfigurationResponse) validateAzure(formats strfmt.Registry) error { - - if swag.IsZero(m.Azure) { // not required - return nil - } - - if m.Azure != nil { - if err := m.Azure.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("azure") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("azure") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfigurationResponse) validateGcp(formats strfmt.Registry) error { - - if swag.IsZero(m.Gcp) { // not required - return nil - } - - if m.Gcp != nil { - if err := m.Gcp.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gcp") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("gcp") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfigurationResponse) validateGemalto(formats strfmt.Registry) error { - - if swag.IsZero(m.Gemalto) { // not required - return nil - } - - if m.Gemalto != nil { - if err := m.Gemalto.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gemalto") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("gemalto") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfigurationResponse) validateKmsMtls(formats strfmt.Registry) error { - - if swag.IsZero(m.KmsMtls) { // not required - return nil - } - - if m.KmsMtls != nil { - if err := m.KmsMtls.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("kms_mtls") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("kms_mtls") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfigurationResponse) validateMinioMtls(formats strfmt.Registry) error { - - if swag.IsZero(m.MinioMtls) { // not required - return nil - } - - if m.MinioMtls != nil { - if err := m.MinioMtls.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("minio_mtls") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("minio_mtls") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfigurationResponse) validateSecurityContext(formats strfmt.Registry) error { - - if swag.IsZero(m.SecurityContext) { // not required - return nil - } - - if m.SecurityContext != nil { - if err := m.SecurityContext.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("securityContext") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfigurationResponse) validateServerTLS(formats strfmt.Registry) error { - - if swag.IsZero(m.ServerTLS) { // not required - return nil - } - - if m.ServerTLS != nil { - if err := m.ServerTLS.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("server_tls") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("server_tls") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfigurationResponse) validateVault(formats strfmt.Registry) error { - - if swag.IsZero(m.Vault) { // not required - return nil - } - - if m.Vault != nil { - if err := m.Vault.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("vault") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("vault") - } - return err - } - } - - return nil -} - -// ContextValidate validate this encryption configuration response based on the context it is used -func (m *EncryptionConfigurationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - // validation for a type composition with MetadataFields - if err := m.MetadataFields.ContextValidate(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateAws(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateAzure(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateGcp(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateGemalto(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateKmsMtls(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateMinioMtls(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateSecurityContext(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateServerTLS(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateVault(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *EncryptionConfigurationResponse) contextValidateAws(ctx context.Context, formats strfmt.Registry) error { - - if m.Aws != nil { - if err := m.Aws.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("aws") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("aws") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfigurationResponse) contextValidateAzure(ctx context.Context, formats strfmt.Registry) error { - - if m.Azure != nil { - if err := m.Azure.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("azure") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("azure") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfigurationResponse) contextValidateGcp(ctx context.Context, formats strfmt.Registry) error { - - if m.Gcp != nil { - if err := m.Gcp.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gcp") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("gcp") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfigurationResponse) contextValidateGemalto(ctx context.Context, formats strfmt.Registry) error { - - if m.Gemalto != nil { - if err := m.Gemalto.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gemalto") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("gemalto") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfigurationResponse) contextValidateKmsMtls(ctx context.Context, formats strfmt.Registry) error { - - if m.KmsMtls != nil { - if err := m.KmsMtls.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("kms_mtls") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("kms_mtls") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfigurationResponse) contextValidateMinioMtls(ctx context.Context, formats strfmt.Registry) error { - - if m.MinioMtls != nil { - if err := m.MinioMtls.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("minio_mtls") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("minio_mtls") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfigurationResponse) contextValidateSecurityContext(ctx context.Context, formats strfmt.Registry) error { - - if m.SecurityContext != nil { - if err := m.SecurityContext.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("securityContext") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfigurationResponse) contextValidateServerTLS(ctx context.Context, formats strfmt.Registry) error { - - if m.ServerTLS != nil { - if err := m.ServerTLS.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("server_tls") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("server_tls") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfigurationResponse) contextValidateVault(ctx context.Context, formats strfmt.Registry) error { - - if m.Vault != nil { - if err := m.Vault.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("vault") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("vault") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *EncryptionConfigurationResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *EncryptionConfigurationResponse) UnmarshalBinary(b []byte) error { - var res EncryptionConfigurationResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// EncryptionConfigurationResponseAO1KmsMtls encryption configuration response a o1 kms mtls -// -// swagger:model EncryptionConfigurationResponseAO1KmsMtls -type EncryptionConfigurationResponseAO1KmsMtls struct { - - // ca - Ca *CertificateInfo `json:"ca,omitempty"` - - // crt - Crt *CertificateInfo `json:"crt,omitempty"` -} - -// Validate validates this encryption configuration response a o1 kms mtls -func (m *EncryptionConfigurationResponseAO1KmsMtls) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateCa(formats); err != nil { - res = append(res, err) - } - - if err := m.validateCrt(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *EncryptionConfigurationResponseAO1KmsMtls) validateCa(formats strfmt.Registry) error { - if swag.IsZero(m.Ca) { // not required - return nil - } - - if m.Ca != nil { - if err := m.Ca.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("kms_mtls" + "." + "ca") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("kms_mtls" + "." + "ca") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfigurationResponseAO1KmsMtls) validateCrt(formats strfmt.Registry) error { - if swag.IsZero(m.Crt) { // not required - return nil - } - - if m.Crt != nil { - if err := m.Crt.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("kms_mtls" + "." + "crt") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("kms_mtls" + "." + "crt") - } - return err - } - } - - return nil -} - -// ContextValidate validate this encryption configuration response a o1 kms mtls based on the context it is used -func (m *EncryptionConfigurationResponseAO1KmsMtls) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateCa(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateCrt(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *EncryptionConfigurationResponseAO1KmsMtls) contextValidateCa(ctx context.Context, formats strfmt.Registry) error { - - if m.Ca != nil { - if err := m.Ca.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("kms_mtls" + "." + "ca") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("kms_mtls" + "." + "ca") - } - return err - } - } - - return nil -} - -func (m *EncryptionConfigurationResponseAO1KmsMtls) contextValidateCrt(ctx context.Context, formats strfmt.Registry) error { - - if m.Crt != nil { - if err := m.Crt.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("kms_mtls" + "." + "crt") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("kms_mtls" + "." + "crt") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *EncryptionConfigurationResponseAO1KmsMtls) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *EncryptionConfigurationResponseAO1KmsMtls) UnmarshalBinary(b []byte) error { - var res EncryptionConfigurationResponseAO1KmsMtls - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/environment_variable.go b/models/environment_variable.go deleted file mode 100644 index d8908bb1a..000000000 --- a/models/environment_variable.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// EnvironmentVariable environment variable -// -// swagger:model environmentVariable -type EnvironmentVariable struct { - - // key - Key string `json:"key,omitempty"` - - // value - Value string `json:"value,omitempty"` -} - -// Validate validates this environment variable -func (m *EnvironmentVariable) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this environment variable based on context it is used -func (m *EnvironmentVariable) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *EnvironmentVariable) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *EnvironmentVariable) UnmarshalBinary(b []byte) error { - var res EnvironmentVariable - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/event_list_element.go b/models/event_list_element.go deleted file mode 100644 index da0a98023..000000000 --- a/models/event_list_element.go +++ /dev/null @@ -1,82 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// EventListElement event list element -// -// swagger:model eventListElement -type EventListElement struct { - - // event type - EventType string `json:"event_type,omitempty"` - - // last seen - LastSeen int64 `json:"last_seen,omitempty"` - - // message - Message string `json:"message,omitempty"` - - // namespace - Namespace string `json:"namespace,omitempty"` - - // object - Object string `json:"object,omitempty"` - - // reason - Reason string `json:"reason,omitempty"` -} - -// Validate validates this event list element -func (m *EventListElement) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this event list element based on context it is used -func (m *EventListElement) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *EventListElement) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *EventListElement) UnmarshalBinary(b []byte) error { - var res EventListElement - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/event_list_wrapper.go b/models/event_list_wrapper.go deleted file mode 100644 index bedeb4086..000000000 --- a/models/event_list_wrapper.go +++ /dev/null @@ -1,90 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// EventListWrapper event list wrapper -// -// swagger:model eventListWrapper -type EventListWrapper []*EventListElement - -// Validate validates this event list wrapper -func (m EventListWrapper) Validate(formats strfmt.Registry) error { - var res []error - - for i := 0; i < len(m); i++ { - if swag.IsZero(m[i]) { // not required - continue - } - - if m[i] != nil { - if err := m[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName(strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName(strconv.Itoa(i)) - } - return err - } - } - - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// ContextValidate validate this event list wrapper based on the context it is used -func (m EventListWrapper) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - for i := 0; i < len(m); i++ { - - if m[i] != nil { - if err := m[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName(strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName(strconv.Itoa(i)) - } - return err - } - } - - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/models/format_configuration.go b/models/format_configuration.go deleted file mode 100644 index 07dc7ed1a..000000000 --- a/models/format_configuration.go +++ /dev/null @@ -1,105 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// FormatConfiguration format configuration -// -// swagger:model formatConfiguration -type FormatConfiguration struct { - - // drives - // Required: true - Drives []string `json:"drives"` - - // force - // Required: true - Force *bool `json:"force"` -} - -// Validate validates this format configuration -func (m *FormatConfiguration) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateDrives(formats); err != nil { - res = append(res, err) - } - - if err := m.validateForce(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *FormatConfiguration) validateDrives(formats strfmt.Registry) error { - - if err := validate.Required("drives", "body", m.Drives); err != nil { - return err - } - - return nil -} - -func (m *FormatConfiguration) validateForce(formats strfmt.Registry) error { - - if err := validate.Required("force", "body", m.Force); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this format configuration based on context it is used -func (m *FormatConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *FormatConfiguration) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *FormatConfiguration) UnmarshalBinary(b []byte) error { - var res FormatConfiguration - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/format_direct_p_v_drives_response.go b/models/format_direct_p_v_drives_response.go deleted file mode 100644 index 29d2b6840..000000000 --- a/models/format_direct_p_v_drives_response.go +++ /dev/null @@ -1,133 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// FormatDirectPVDrivesResponse format direct p v drives response -// -// swagger:model formatDirectPVDrivesResponse -type FormatDirectPVDrivesResponse struct { - - // format issues list - FormatIssuesList []*PvFormatErrorResponse `json:"formatIssuesList"` -} - -// Validate validates this format direct p v drives response -func (m *FormatDirectPVDrivesResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateFormatIssuesList(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *FormatDirectPVDrivesResponse) validateFormatIssuesList(formats strfmt.Registry) error { - if swag.IsZero(m.FormatIssuesList) { // not required - return nil - } - - for i := 0; i < len(m.FormatIssuesList); i++ { - if swag.IsZero(m.FormatIssuesList[i]) { // not required - continue - } - - if m.FormatIssuesList[i] != nil { - if err := m.FormatIssuesList[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("formatIssuesList" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("formatIssuesList" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this format direct p v drives response based on the context it is used -func (m *FormatDirectPVDrivesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateFormatIssuesList(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *FormatDirectPVDrivesResponse) contextValidateFormatIssuesList(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.FormatIssuesList); i++ { - - if m.FormatIssuesList[i] != nil { - if err := m.FormatIssuesList[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("formatIssuesList" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("formatIssuesList" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *FormatDirectPVDrivesResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *FormatDirectPVDrivesResponse) UnmarshalBinary(b []byte) error { - var res FormatDirectPVDrivesResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/gcp_configuration.go b/models/gcp_configuration.go deleted file mode 100644 index b39c979d6..000000000 --- a/models/gcp_configuration.go +++ /dev/null @@ -1,280 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// GcpConfiguration gcp configuration -// -// swagger:model gcpConfiguration -type GcpConfiguration struct { - - // secretmanager - // Required: true - Secretmanager *GcpConfigurationSecretmanager `json:"secretmanager"` -} - -// Validate validates this gcp configuration -func (m *GcpConfiguration) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateSecretmanager(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GcpConfiguration) validateSecretmanager(formats strfmt.Registry) error { - - if err := validate.Required("secretmanager", "body", m.Secretmanager); err != nil { - return err - } - - if m.Secretmanager != nil { - if err := m.Secretmanager.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("secretmanager") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("secretmanager") - } - return err - } - } - - return nil -} - -// ContextValidate validate this gcp configuration based on the context it is used -func (m *GcpConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateSecretmanager(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GcpConfiguration) contextValidateSecretmanager(ctx context.Context, formats strfmt.Registry) error { - - if m.Secretmanager != nil { - if err := m.Secretmanager.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("secretmanager") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("secretmanager") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *GcpConfiguration) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *GcpConfiguration) UnmarshalBinary(b []byte) error { - var res GcpConfiguration - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// GcpConfigurationSecretmanager gcp configuration secretmanager -// -// swagger:model GcpConfigurationSecretmanager -type GcpConfigurationSecretmanager struct { - - // credentials - Credentials *GcpConfigurationSecretmanagerCredentials `json:"credentials,omitempty"` - - // endpoint - Endpoint string `json:"endpoint,omitempty"` - - // project id - // Required: true - ProjectID *string `json:"project_id"` -} - -// Validate validates this gcp configuration secretmanager -func (m *GcpConfigurationSecretmanager) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateCredentials(formats); err != nil { - res = append(res, err) - } - - if err := m.validateProjectID(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GcpConfigurationSecretmanager) validateCredentials(formats strfmt.Registry) error { - if swag.IsZero(m.Credentials) { // not required - return nil - } - - if m.Credentials != nil { - if err := m.Credentials.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("secretmanager" + "." + "credentials") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("secretmanager" + "." + "credentials") - } - return err - } - } - - return nil -} - -func (m *GcpConfigurationSecretmanager) validateProjectID(formats strfmt.Registry) error { - - if err := validate.Required("secretmanager"+"."+"project_id", "body", m.ProjectID); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this gcp configuration secretmanager based on the context it is used -func (m *GcpConfigurationSecretmanager) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateCredentials(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GcpConfigurationSecretmanager) contextValidateCredentials(ctx context.Context, formats strfmt.Registry) error { - - if m.Credentials != nil { - if err := m.Credentials.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("secretmanager" + "." + "credentials") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("secretmanager" + "." + "credentials") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *GcpConfigurationSecretmanager) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *GcpConfigurationSecretmanager) UnmarshalBinary(b []byte) error { - var res GcpConfigurationSecretmanager - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// GcpConfigurationSecretmanagerCredentials gcp configuration secretmanager credentials -// -// swagger:model GcpConfigurationSecretmanagerCredentials -type GcpConfigurationSecretmanagerCredentials struct { - - // client email - ClientEmail string `json:"client_email,omitempty"` - - // client id - ClientID string `json:"client_id,omitempty"` - - // private key - PrivateKey string `json:"private_key,omitempty"` - - // private key id - PrivateKeyID string `json:"private_key_id,omitempty"` -} - -// Validate validates this gcp configuration secretmanager credentials -func (m *GcpConfigurationSecretmanagerCredentials) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this gcp configuration secretmanager credentials based on context it is used -func (m *GcpConfigurationSecretmanagerCredentials) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *GcpConfigurationSecretmanagerCredentials) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *GcpConfigurationSecretmanagerCredentials) UnmarshalBinary(b []byte) error { - var res GcpConfigurationSecretmanagerCredentials - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/gemalto_configuration.go b/models/gemalto_configuration.go deleted file mode 100644 index 3866244b6..000000000 --- a/models/gemalto_configuration.go +++ /dev/null @@ -1,309 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// GemaltoConfiguration gemalto configuration -// -// swagger:model gemaltoConfiguration -type GemaltoConfiguration struct { - - // keysecure - // Required: true - Keysecure *GemaltoConfigurationKeysecure `json:"keysecure"` -} - -// Validate validates this gemalto configuration -func (m *GemaltoConfiguration) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateKeysecure(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GemaltoConfiguration) validateKeysecure(formats strfmt.Registry) error { - - if err := validate.Required("keysecure", "body", m.Keysecure); err != nil { - return err - } - - if m.Keysecure != nil { - if err := m.Keysecure.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keysecure") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("keysecure") - } - return err - } - } - - return nil -} - -// ContextValidate validate this gemalto configuration based on the context it is used -func (m *GemaltoConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateKeysecure(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GemaltoConfiguration) contextValidateKeysecure(ctx context.Context, formats strfmt.Registry) error { - - if m.Keysecure != nil { - if err := m.Keysecure.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keysecure") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("keysecure") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *GemaltoConfiguration) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *GemaltoConfiguration) UnmarshalBinary(b []byte) error { - var res GemaltoConfiguration - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// GemaltoConfigurationKeysecure gemalto configuration keysecure -// -// swagger:model GemaltoConfigurationKeysecure -type GemaltoConfigurationKeysecure struct { - - // credentials - // Required: true - Credentials *GemaltoConfigurationKeysecureCredentials `json:"credentials"` - - // endpoint - // Required: true - Endpoint *string `json:"endpoint"` -} - -// Validate validates this gemalto configuration keysecure -func (m *GemaltoConfigurationKeysecure) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateCredentials(formats); err != nil { - res = append(res, err) - } - - if err := m.validateEndpoint(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GemaltoConfigurationKeysecure) validateCredentials(formats strfmt.Registry) error { - - if err := validate.Required("keysecure"+"."+"credentials", "body", m.Credentials); err != nil { - return err - } - - if m.Credentials != nil { - if err := m.Credentials.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keysecure" + "." + "credentials") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("keysecure" + "." + "credentials") - } - return err - } - } - - return nil -} - -func (m *GemaltoConfigurationKeysecure) validateEndpoint(formats strfmt.Registry) error { - - if err := validate.Required("keysecure"+"."+"endpoint", "body", m.Endpoint); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this gemalto configuration keysecure based on the context it is used -func (m *GemaltoConfigurationKeysecure) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateCredentials(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GemaltoConfigurationKeysecure) contextValidateCredentials(ctx context.Context, formats strfmt.Registry) error { - - if m.Credentials != nil { - if err := m.Credentials.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keysecure" + "." + "credentials") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("keysecure" + "." + "credentials") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *GemaltoConfigurationKeysecure) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *GemaltoConfigurationKeysecure) UnmarshalBinary(b []byte) error { - var res GemaltoConfigurationKeysecure - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// GemaltoConfigurationKeysecureCredentials gemalto configuration keysecure credentials -// -// swagger:model GemaltoConfigurationKeysecureCredentials -type GemaltoConfigurationKeysecureCredentials struct { - - // domain - // Required: true - Domain *string `json:"domain"` - - // retry - Retry int64 `json:"retry,omitempty"` - - // token - // Required: true - Token *string `json:"token"` -} - -// Validate validates this gemalto configuration keysecure credentials -func (m *GemaltoConfigurationKeysecureCredentials) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateDomain(formats); err != nil { - res = append(res, err) - } - - if err := m.validateToken(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GemaltoConfigurationKeysecureCredentials) validateDomain(formats strfmt.Registry) error { - - if err := validate.Required("keysecure"+"."+"credentials"+"."+"domain", "body", m.Domain); err != nil { - return err - } - - return nil -} - -func (m *GemaltoConfigurationKeysecureCredentials) validateToken(formats strfmt.Registry) error { - - if err := validate.Required("keysecure"+"."+"credentials"+"."+"token", "body", m.Token); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this gemalto configuration keysecure credentials based on context it is used -func (m *GemaltoConfigurationKeysecureCredentials) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *GemaltoConfigurationKeysecureCredentials) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *GemaltoConfigurationKeysecureCredentials) UnmarshalBinary(b []byte) error { - var res GemaltoConfigurationKeysecureCredentials - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/gemalto_configuration_response.go b/models/gemalto_configuration_response.go deleted file mode 100644 index 9f70db855..000000000 --- a/models/gemalto_configuration_response.go +++ /dev/null @@ -1,309 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// GemaltoConfigurationResponse gemalto configuration response -// -// swagger:model gemaltoConfigurationResponse -type GemaltoConfigurationResponse struct { - - // keysecure - // Required: true - Keysecure *GemaltoConfigurationResponseKeysecure `json:"keysecure"` -} - -// Validate validates this gemalto configuration response -func (m *GemaltoConfigurationResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateKeysecure(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GemaltoConfigurationResponse) validateKeysecure(formats strfmt.Registry) error { - - if err := validate.Required("keysecure", "body", m.Keysecure); err != nil { - return err - } - - if m.Keysecure != nil { - if err := m.Keysecure.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keysecure") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("keysecure") - } - return err - } - } - - return nil -} - -// ContextValidate validate this gemalto configuration response based on the context it is used -func (m *GemaltoConfigurationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateKeysecure(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GemaltoConfigurationResponse) contextValidateKeysecure(ctx context.Context, formats strfmt.Registry) error { - - if m.Keysecure != nil { - if err := m.Keysecure.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keysecure") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("keysecure") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *GemaltoConfigurationResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *GemaltoConfigurationResponse) UnmarshalBinary(b []byte) error { - var res GemaltoConfigurationResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// GemaltoConfigurationResponseKeysecure gemalto configuration response keysecure -// -// swagger:model GemaltoConfigurationResponseKeysecure -type GemaltoConfigurationResponseKeysecure struct { - - // credentials - // Required: true - Credentials *GemaltoConfigurationResponseKeysecureCredentials `json:"credentials"` - - // endpoint - // Required: true - Endpoint *string `json:"endpoint"` -} - -// Validate validates this gemalto configuration response keysecure -func (m *GemaltoConfigurationResponseKeysecure) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateCredentials(formats); err != nil { - res = append(res, err) - } - - if err := m.validateEndpoint(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GemaltoConfigurationResponseKeysecure) validateCredentials(formats strfmt.Registry) error { - - if err := validate.Required("keysecure"+"."+"credentials", "body", m.Credentials); err != nil { - return err - } - - if m.Credentials != nil { - if err := m.Credentials.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keysecure" + "." + "credentials") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("keysecure" + "." + "credentials") - } - return err - } - } - - return nil -} - -func (m *GemaltoConfigurationResponseKeysecure) validateEndpoint(formats strfmt.Registry) error { - - if err := validate.Required("keysecure"+"."+"endpoint", "body", m.Endpoint); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this gemalto configuration response keysecure based on the context it is used -func (m *GemaltoConfigurationResponseKeysecure) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateCredentials(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GemaltoConfigurationResponseKeysecure) contextValidateCredentials(ctx context.Context, formats strfmt.Registry) error { - - if m.Credentials != nil { - if err := m.Credentials.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keysecure" + "." + "credentials") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("keysecure" + "." + "credentials") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *GemaltoConfigurationResponseKeysecure) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *GemaltoConfigurationResponseKeysecure) UnmarshalBinary(b []byte) error { - var res GemaltoConfigurationResponseKeysecure - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// GemaltoConfigurationResponseKeysecureCredentials gemalto configuration response keysecure credentials -// -// swagger:model GemaltoConfigurationResponseKeysecureCredentials -type GemaltoConfigurationResponseKeysecureCredentials struct { - - // domain - // Required: true - Domain *string `json:"domain"` - - // retry - Retry int64 `json:"retry,omitempty"` - - // token - // Required: true - Token *string `json:"token"` -} - -// Validate validates this gemalto configuration response keysecure credentials -func (m *GemaltoConfigurationResponseKeysecureCredentials) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateDomain(formats); err != nil { - res = append(res, err) - } - - if err := m.validateToken(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GemaltoConfigurationResponseKeysecureCredentials) validateDomain(formats strfmt.Registry) error { - - if err := validate.Required("keysecure"+"."+"credentials"+"."+"domain", "body", m.Domain); err != nil { - return err - } - - return nil -} - -func (m *GemaltoConfigurationResponseKeysecureCredentials) validateToken(formats strfmt.Registry) error { - - if err := validate.Required("keysecure"+"."+"credentials"+"."+"token", "body", m.Token); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this gemalto configuration response keysecure credentials based on context it is used -func (m *GemaltoConfigurationResponseKeysecureCredentials) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *GemaltoConfigurationResponseKeysecureCredentials) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *GemaltoConfigurationResponseKeysecureCredentials) UnmarshalBinary(b []byte) error { - var res GemaltoConfigurationResponseKeysecureCredentials - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/get_direct_p_v_drive_list_response.go b/models/get_direct_p_v_drive_list_response.go deleted file mode 100644 index e1ba79630..000000000 --- a/models/get_direct_p_v_drive_list_response.go +++ /dev/null @@ -1,133 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// GetDirectPVDriveListResponse get direct p v drive list response -// -// swagger:model getDirectPVDriveListResponse -type GetDirectPVDriveListResponse struct { - - // drives - Drives []*DirectPVDriveInfo `json:"drives"` -} - -// Validate validates this get direct p v drive list response -func (m *GetDirectPVDriveListResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateDrives(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GetDirectPVDriveListResponse) validateDrives(formats strfmt.Registry) error { - if swag.IsZero(m.Drives) { // not required - return nil - } - - for i := 0; i < len(m.Drives); i++ { - if swag.IsZero(m.Drives[i]) { // not required - continue - } - - if m.Drives[i] != nil { - if err := m.Drives[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("drives" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("drives" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this get direct p v drive list response based on the context it is used -func (m *GetDirectPVDriveListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateDrives(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GetDirectPVDriveListResponse) contextValidateDrives(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Drives); i++ { - - if m.Drives[i] != nil { - if err := m.Drives[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("drives" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("drives" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *GetDirectPVDriveListResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *GetDirectPVDriveListResponse) UnmarshalBinary(b []byte) error { - var res GetDirectPVDriveListResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/get_direct_p_v_volume_list_response.go b/models/get_direct_p_v_volume_list_response.go deleted file mode 100644 index 7f36cf592..000000000 --- a/models/get_direct_p_v_volume_list_response.go +++ /dev/null @@ -1,133 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// GetDirectPVVolumeListResponse get direct p v volume list response -// -// swagger:model getDirectPVVolumeListResponse -type GetDirectPVVolumeListResponse struct { - - // volumes - Volumes []*DirectPVVolumeInfo `json:"volumes"` -} - -// Validate validates this get direct p v volume list response -func (m *GetDirectPVVolumeListResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateVolumes(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GetDirectPVVolumeListResponse) validateVolumes(formats strfmt.Registry) error { - if swag.IsZero(m.Volumes) { // not required - return nil - } - - for i := 0; i < len(m.Volumes); i++ { - if swag.IsZero(m.Volumes[i]) { // not required - continue - } - - if m.Volumes[i] != nil { - if err := m.Volumes[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("volumes" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("volumes" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this get direct p v volume list response based on the context it is used -func (m *GetDirectPVVolumeListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateVolumes(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GetDirectPVVolumeListResponse) contextValidateVolumes(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Volumes); i++ { - - if m.Volumes[i] != nil { - if err := m.Volumes[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("volumes" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("volumes" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *GetDirectPVVolumeListResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *GetDirectPVVolumeListResponse) UnmarshalBinary(b []byte) error { - var res GetDirectPVVolumeListResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/idp_configuration.go b/models/idp_configuration.go deleted file mode 100644 index d3bcd3640..000000000 --- a/models/idp_configuration.go +++ /dev/null @@ -1,512 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// IdpConfiguration idp configuration -// -// swagger:model idpConfiguration -type IdpConfiguration struct { - - // active directory - ActiveDirectory *IdpConfigurationActiveDirectory `json:"active_directory,omitempty"` - - // keys - Keys []*IdpConfigurationKeysItems0 `json:"keys"` - - // oidc - Oidc *IdpConfigurationOidc `json:"oidc,omitempty"` -} - -// Validate validates this idp configuration -func (m *IdpConfiguration) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateActiveDirectory(formats); err != nil { - res = append(res, err) - } - - if err := m.validateKeys(formats); err != nil { - res = append(res, err) - } - - if err := m.validateOidc(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *IdpConfiguration) validateActiveDirectory(formats strfmt.Registry) error { - if swag.IsZero(m.ActiveDirectory) { // not required - return nil - } - - if m.ActiveDirectory != nil { - if err := m.ActiveDirectory.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("active_directory") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("active_directory") - } - return err - } - } - - return nil -} - -func (m *IdpConfiguration) validateKeys(formats strfmt.Registry) error { - if swag.IsZero(m.Keys) { // not required - return nil - } - - for i := 0; i < len(m.Keys); i++ { - if swag.IsZero(m.Keys[i]) { // not required - continue - } - - if m.Keys[i] != nil { - if err := m.Keys[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keys" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("keys" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *IdpConfiguration) validateOidc(formats strfmt.Registry) error { - if swag.IsZero(m.Oidc) { // not required - return nil - } - - if m.Oidc != nil { - if err := m.Oidc.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("oidc") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("oidc") - } - return err - } - } - - return nil -} - -// ContextValidate validate this idp configuration based on the context it is used -func (m *IdpConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateActiveDirectory(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateKeys(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateOidc(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *IdpConfiguration) contextValidateActiveDirectory(ctx context.Context, formats strfmt.Registry) error { - - if m.ActiveDirectory != nil { - if err := m.ActiveDirectory.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("active_directory") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("active_directory") - } - return err - } - } - - return nil -} - -func (m *IdpConfiguration) contextValidateKeys(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Keys); i++ { - - if m.Keys[i] != nil { - if err := m.Keys[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keys" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("keys" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *IdpConfiguration) contextValidateOidc(ctx context.Context, formats strfmt.Registry) error { - - if m.Oidc != nil { - if err := m.Oidc.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("oidc") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("oidc") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *IdpConfiguration) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *IdpConfiguration) UnmarshalBinary(b []byte) error { - var res IdpConfiguration - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// IdpConfigurationActiveDirectory idp configuration active directory -// -// swagger:model IdpConfigurationActiveDirectory -type IdpConfigurationActiveDirectory struct { - - // group search base dn - GroupSearchBaseDn string `json:"group_search_base_dn,omitempty"` - - // group search filter - GroupSearchFilter string `json:"group_search_filter,omitempty"` - - // lookup bind dn - // Required: true - LookupBindDn *string `json:"lookup_bind_dn"` - - // lookup bind password - LookupBindPassword string `json:"lookup_bind_password,omitempty"` - - // server insecure - ServerInsecure bool `json:"server_insecure,omitempty"` - - // server start tls - ServerStartTLS bool `json:"server_start_tls,omitempty"` - - // skip tls verification - SkipTLSVerification bool `json:"skip_tls_verification,omitempty"` - - // url - // Required: true - URL *string `json:"url"` - - // user dn search base dn - UserDnSearchBaseDn string `json:"user_dn_search_base_dn,omitempty"` - - // user dn search filter - UserDnSearchFilter string `json:"user_dn_search_filter,omitempty"` - - // user dns - UserDNS []string `json:"user_dns"` -} - -// Validate validates this idp configuration active directory -func (m *IdpConfigurationActiveDirectory) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateLookupBindDn(formats); err != nil { - res = append(res, err) - } - - if err := m.validateURL(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *IdpConfigurationActiveDirectory) validateLookupBindDn(formats strfmt.Registry) error { - - if err := validate.Required("active_directory"+"."+"lookup_bind_dn", "body", m.LookupBindDn); err != nil { - return err - } - - return nil -} - -func (m *IdpConfigurationActiveDirectory) validateURL(formats strfmt.Registry) error { - - if err := validate.Required("active_directory"+"."+"url", "body", m.URL); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this idp configuration active directory based on context it is used -func (m *IdpConfigurationActiveDirectory) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *IdpConfigurationActiveDirectory) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *IdpConfigurationActiveDirectory) UnmarshalBinary(b []byte) error { - var res IdpConfigurationActiveDirectory - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// IdpConfigurationKeysItems0 idp configuration keys items0 -// -// swagger:model IdpConfigurationKeysItems0 -type IdpConfigurationKeysItems0 struct { - - // access key - // Required: true - AccessKey *string `json:"access_key"` - - // secret key - // Required: true - SecretKey *string `json:"secret_key"` -} - -// Validate validates this idp configuration keys items0 -func (m *IdpConfigurationKeysItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAccessKey(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSecretKey(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *IdpConfigurationKeysItems0) validateAccessKey(formats strfmt.Registry) error { - - if err := validate.Required("access_key", "body", m.AccessKey); err != nil { - return err - } - - return nil -} - -func (m *IdpConfigurationKeysItems0) validateSecretKey(formats strfmt.Registry) error { - - if err := validate.Required("secret_key", "body", m.SecretKey); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this idp configuration keys items0 based on context it is used -func (m *IdpConfigurationKeysItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *IdpConfigurationKeysItems0) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *IdpConfigurationKeysItems0) UnmarshalBinary(b []byte) error { - var res IdpConfigurationKeysItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// IdpConfigurationOidc idp configuration oidc -// -// swagger:model IdpConfigurationOidc -type IdpConfigurationOidc struct { - - // callback url - CallbackURL string `json:"callback_url,omitempty"` - - // claim name - // Required: true - ClaimName *string `json:"claim_name"` - - // client id - // Required: true - ClientID *string `json:"client_id"` - - // configuration url - // Required: true - ConfigurationURL *string `json:"configuration_url"` - - // scopes - Scopes string `json:"scopes,omitempty"` - - // secret id - // Required: true - SecretID *string `json:"secret_id"` -} - -// Validate validates this idp configuration oidc -func (m *IdpConfigurationOidc) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateClaimName(formats); err != nil { - res = append(res, err) - } - - if err := m.validateClientID(formats); err != nil { - res = append(res, err) - } - - if err := m.validateConfigurationURL(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSecretID(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *IdpConfigurationOidc) validateClaimName(formats strfmt.Registry) error { - - if err := validate.Required("oidc"+"."+"claim_name", "body", m.ClaimName); err != nil { - return err - } - - return nil -} - -func (m *IdpConfigurationOidc) validateClientID(formats strfmt.Registry) error { - - if err := validate.Required("oidc"+"."+"client_id", "body", m.ClientID); err != nil { - return err - } - - return nil -} - -func (m *IdpConfigurationOidc) validateConfigurationURL(formats strfmt.Registry) error { - - if err := validate.Required("oidc"+"."+"configuration_url", "body", m.ConfigurationURL); err != nil { - return err - } - - return nil -} - -func (m *IdpConfigurationOidc) validateSecretID(formats strfmt.Registry) error { - - if err := validate.Required("oidc"+"."+"secret_id", "body", m.SecretID); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this idp configuration oidc based on context it is used -func (m *IdpConfigurationOidc) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *IdpConfigurationOidc) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *IdpConfigurationOidc) UnmarshalBinary(b []byte) error { - var res IdpConfigurationOidc - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/image_registry.go b/models/image_registry.go deleted file mode 100644 index e0269a65c..000000000 --- a/models/image_registry.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// ImageRegistry image registry -// -// swagger:model imageRegistry -type ImageRegistry struct { - - // password - // Required: true - Password *string `json:"password"` - - // registry - // Required: true - Registry *string `json:"registry"` - - // username - // Required: true - Username *string `json:"username"` -} - -// Validate validates this image registry -func (m *ImageRegistry) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validatePassword(formats); err != nil { - res = append(res, err) - } - - if err := m.validateRegistry(formats); err != nil { - res = append(res, err) - } - - if err := m.validateUsername(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ImageRegistry) validatePassword(formats strfmt.Registry) error { - - if err := validate.Required("password", "body", m.Password); err != nil { - return err - } - - return nil -} - -func (m *ImageRegistry) validateRegistry(formats strfmt.Registry) error { - - if err := validate.Required("registry", "body", m.Registry); err != nil { - return err - } - - return nil -} - -func (m *ImageRegistry) validateUsername(formats strfmt.Registry) error { - - if err := validate.Required("username", "body", m.Username); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this image registry based on context it is used -func (m *ImageRegistry) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *ImageRegistry) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ImageRegistry) UnmarshalBinary(b []byte) error { - var res ImageRegistry - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/key_pair_configuration.go b/models/key_pair_configuration.go deleted file mode 100644 index 06aab570c..000000000 --- a/models/key_pair_configuration.go +++ /dev/null @@ -1,105 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// KeyPairConfiguration key pair configuration -// -// swagger:model keyPairConfiguration -type KeyPairConfiguration struct { - - // crt - // Required: true - Crt *string `json:"crt"` - - // key - // Required: true - Key *string `json:"key"` -} - -// Validate validates this key pair configuration -func (m *KeyPairConfiguration) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateCrt(formats); err != nil { - res = append(res, err) - } - - if err := m.validateKey(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *KeyPairConfiguration) validateCrt(formats strfmt.Registry) error { - - if err := validate.Required("crt", "body", m.Crt); err != nil { - return err - } - - return nil -} - -func (m *KeyPairConfiguration) validateKey(formats strfmt.Registry) error { - - if err := validate.Required("key", "body", m.Key); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this key pair configuration based on context it is used -func (m *KeyPairConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *KeyPairConfiguration) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *KeyPairConfiguration) UnmarshalBinary(b []byte) error { - var res KeyPairConfiguration - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/label.go b/models/label.go deleted file mode 100644 index 03322d203..000000000 --- a/models/label.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// Label label -// -// swagger:model label -type Label struct { - - // key - Key string `json:"key,omitempty"` - - // value - Value string `json:"value,omitempty"` -} - -// Validate validates this label -func (m *Label) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this label based on context it is used -func (m *Label) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *Label) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *Label) UnmarshalBinary(b []byte) error { - var res Label - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/list_p_v_cs_response.go b/models/list_p_v_cs_response.go deleted file mode 100644 index eefd9f906..000000000 --- a/models/list_p_v_cs_response.go +++ /dev/null @@ -1,133 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// ListPVCsResponse list p v cs response -// -// swagger:model listPVCsResponse -type ListPVCsResponse struct { - - // pvcs - Pvcs []*PvcsListResponse `json:"pvcs"` -} - -// Validate validates this list p v cs response -func (m *ListPVCsResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validatePvcs(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ListPVCsResponse) validatePvcs(formats strfmt.Registry) error { - if swag.IsZero(m.Pvcs) { // not required - return nil - } - - for i := 0; i < len(m.Pvcs); i++ { - if swag.IsZero(m.Pvcs[i]) { // not required - continue - } - - if m.Pvcs[i] != nil { - if err := m.Pvcs[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("pvcs" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("pvcs" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this list p v cs response based on the context it is used -func (m *ListPVCsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidatePvcs(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ListPVCsResponse) contextValidatePvcs(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Pvcs); i++ { - - if m.Pvcs[i] != nil { - if err := m.Pvcs[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("pvcs" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("pvcs" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *ListPVCsResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ListPVCsResponse) UnmarshalBinary(b []byte) error { - var res ListPVCsResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/list_tenants_response.go b/models/list_tenants_response.go deleted file mode 100644 index 7ab96d185..000000000 --- a/models/list_tenants_response.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// ListTenantsResponse list tenants response -// -// swagger:model listTenantsResponse -type ListTenantsResponse struct { - - // list of resulting tenants - Tenants []*TenantList `json:"tenants"` - - // number of tenants accessible to tenant user - Total int64 `json:"total,omitempty"` -} - -// Validate validates this list tenants response -func (m *ListTenantsResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateTenants(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ListTenantsResponse) validateTenants(formats strfmt.Registry) error { - if swag.IsZero(m.Tenants) { // not required - return nil - } - - for i := 0; i < len(m.Tenants); i++ { - if swag.IsZero(m.Tenants[i]) { // not required - continue - } - - if m.Tenants[i] != nil { - if err := m.Tenants[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("tenants" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("tenants" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this list tenants response based on the context it is used -func (m *ListTenantsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateTenants(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ListTenantsResponse) contextValidateTenants(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Tenants); i++ { - - if m.Tenants[i] != nil { - if err := m.Tenants[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("tenants" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("tenants" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *ListTenantsResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ListTenantsResponse) UnmarshalBinary(b []byte) error { - var res ListTenantsResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/log_search_configuration.go b/models/log_search_configuration.go deleted file mode 100644 index 9349a4014..000000000 --- a/models/log_search_configuration.go +++ /dev/null @@ -1,182 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// LogSearchConfiguration log search configuration -// -// swagger:model logSearchConfiguration -type LogSearchConfiguration struct { - - // image - Image string `json:"image,omitempty"` - - // postgres image - PostgresImage string `json:"postgres_image,omitempty"` - - // postgres init image - PostgresInitImage string `json:"postgres_init_image,omitempty"` - - // postgres security context - PostgresSecurityContext *SecurityContext `json:"postgres_securityContext,omitempty"` - - // security context - SecurityContext *SecurityContext `json:"securityContext,omitempty"` - - // storage class - StorageClass string `json:"storageClass,omitempty"` - - // storage size - StorageSize *float64 `json:"storageSize,omitempty"` -} - -// Validate validates this log search configuration -func (m *LogSearchConfiguration) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validatePostgresSecurityContext(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSecurityContext(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *LogSearchConfiguration) validatePostgresSecurityContext(formats strfmt.Registry) error { - if swag.IsZero(m.PostgresSecurityContext) { // not required - return nil - } - - if m.PostgresSecurityContext != nil { - if err := m.PostgresSecurityContext.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("postgres_securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("postgres_securityContext") - } - return err - } - } - - return nil -} - -func (m *LogSearchConfiguration) validateSecurityContext(formats strfmt.Registry) error { - if swag.IsZero(m.SecurityContext) { // not required - return nil - } - - if m.SecurityContext != nil { - if err := m.SecurityContext.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("securityContext") - } - return err - } - } - - return nil -} - -// ContextValidate validate this log search configuration based on the context it is used -func (m *LogSearchConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidatePostgresSecurityContext(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateSecurityContext(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *LogSearchConfiguration) contextValidatePostgresSecurityContext(ctx context.Context, formats strfmt.Registry) error { - - if m.PostgresSecurityContext != nil { - if err := m.PostgresSecurityContext.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("postgres_securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("postgres_securityContext") - } - return err - } - } - - return nil -} - -func (m *LogSearchConfiguration) contextValidateSecurityContext(ctx context.Context, formats strfmt.Registry) error { - - if m.SecurityContext != nil { - if err := m.SecurityContext.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("securityContext") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *LogSearchConfiguration) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *LogSearchConfiguration) UnmarshalBinary(b []byte) error { - var res LogSearchConfiguration - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/login_operator_request.go b/models/login_operator_request.go deleted file mode 100644 index a0d70d30b..000000000 --- a/models/login_operator_request.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// LoginOperatorRequest login operator request -// -// swagger:model loginOperatorRequest -type LoginOperatorRequest struct { - - // jwt - // Required: true - Jwt *string `json:"jwt"` -} - -// Validate validates this login operator request -func (m *LoginOperatorRequest) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateJwt(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *LoginOperatorRequest) validateJwt(formats strfmt.Registry) error { - - if err := validate.Required("jwt", "body", m.Jwt); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this login operator request based on context it is used -func (m *LoginOperatorRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *LoginOperatorRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *LoginOperatorRequest) UnmarshalBinary(b []byte) error { - var res LoginOperatorRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/max_allocatable_mem_response.go b/models/max_allocatable_mem_response.go deleted file mode 100644 index bb15cc0fd..000000000 --- a/models/max_allocatable_mem_response.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// MaxAllocatableMemResponse max allocatable mem response -// -// swagger:model maxAllocatableMemResponse -type MaxAllocatableMemResponse struct { - - // max memory - MaxMemory int64 `json:"max_memory,omitempty"` -} - -// Validate validates this max allocatable mem response -func (m *MaxAllocatableMemResponse) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this max allocatable mem response based on context it is used -func (m *MaxAllocatableMemResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *MaxAllocatableMemResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *MaxAllocatableMemResponse) UnmarshalBinary(b []byte) error { - var res MaxAllocatableMemResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/metadata_fields.go b/models/metadata_fields.go deleted file mode 100644 index 873873817..000000000 --- a/models/metadata_fields.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// MetadataFields metadata fields -// -// swagger:model metadataFields -type MetadataFields struct { - - // annotations - Annotations map[string]string `json:"annotations,omitempty"` - - // labels - Labels map[string]string `json:"labels,omitempty"` - - // node selector - NodeSelector map[string]string `json:"node_selector,omitempty"` -} - -// Validate validates this metadata fields -func (m *MetadataFields) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this metadata fields based on context it is used -func (m *MetadataFields) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *MetadataFields) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *MetadataFields) UnmarshalBinary(b []byte) error { - var res MetadataFields - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/mount.go b/models/mount.go deleted file mode 100644 index e32667f64..000000000 --- a/models/mount.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// Mount mount -// -// swagger:model mount -type Mount struct { - - // mount path - MountPath string `json:"mountPath,omitempty"` - - // name - Name string `json:"name,omitempty"` - - // read only - ReadOnly bool `json:"readOnly,omitempty"` - - // sub path - SubPath string `json:"subPath,omitempty"` -} - -// Validate validates this mount -func (m *Mount) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this mount based on context it is used -func (m *Mount) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *Mount) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *Mount) UnmarshalBinary(b []byte) error { - var res Mount - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/mp_integration.go b/models/mp_integration.go deleted file mode 100644 index c90ba3eb7..000000000 --- a/models/mp_integration.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// MpIntegration mp integration -// -// swagger:model mpIntegration -type MpIntegration struct { - - // email - Email string `json:"email,omitempty"` - - // is in e u - IsInEU bool `json:"isInEU,omitempty"` -} - -// Validate validates this mp integration -func (m *MpIntegration) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this mp integration based on context it is used -func (m *MpIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *MpIntegration) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *MpIntegration) UnmarshalBinary(b []byte) error { - var res MpIntegration - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/namespace.go b/models/namespace.go deleted file mode 100644 index 3ff43baa1..000000000 --- a/models/namespace.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// Namespace namespace -// -// swagger:model namespace -type Namespace struct { - - // name - // Required: true - Name *string `json:"name"` -} - -// Validate validates this namespace -func (m *Namespace) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateName(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Namespace) validateName(formats strfmt.Registry) error { - - if err := validate.Required("name", "body", m.Name); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this namespace based on context it is used -func (m *Namespace) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *Namespace) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *Namespace) UnmarshalBinary(b []byte) error { - var res Namespace - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/node_labels.go b/models/node_labels.go deleted file mode 100644 index a8acf4532..000000000 --- a/models/node_labels.go +++ /dev/null @@ -1,44 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" -) - -// NodeLabels node labels -// -// swagger:model nodeLabels -type NodeLabels map[string][]string - -// Validate validates this node labels -func (m NodeLabels) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this node labels based on context it is used -func (m NodeLabels) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/models/node_max_allocatable_resources.go b/models/node_max_allocatable_resources.go deleted file mode 100644 index 1e2ebee94..000000000 --- a/models/node_max_allocatable_resources.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NodeMaxAllocatableResources node max allocatable resources -// -// swagger:model nodeMaxAllocatableResources -type NodeMaxAllocatableResources struct { - - // max allocatable cpu - MaxAllocatableCPU int64 `json:"max_allocatable_cpu,omitempty"` - - // max allocatable mem - MaxAllocatableMem int64 `json:"max_allocatable_mem,omitempty"` -} - -// Validate validates this node max allocatable resources -func (m *NodeMaxAllocatableResources) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this node max allocatable resources based on context it is used -func (m *NodeMaxAllocatableResources) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *NodeMaxAllocatableResources) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *NodeMaxAllocatableResources) UnmarshalBinary(b []byte) error { - var res NodeMaxAllocatableResources - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/node_selector.go b/models/node_selector.go deleted file mode 100644 index 644df6db4..000000000 --- a/models/node_selector.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NodeSelector node selector -// -// swagger:model nodeSelector -type NodeSelector struct { - - // key - Key string `json:"key,omitempty"` - - // value - Value string `json:"value,omitempty"` -} - -// Validate validates this node selector -func (m *NodeSelector) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this node selector based on context it is used -func (m *NodeSelector) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *NodeSelector) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *NodeSelector) UnmarshalBinary(b []byte) error { - var res NodeSelector - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/node_selector_term.go b/models/node_selector_term.go deleted file mode 100644 index e24012a40..000000000 --- a/models/node_selector_term.go +++ /dev/null @@ -1,343 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NodeSelectorTerm A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. -// -// swagger:model nodeSelectorTerm -type NodeSelectorTerm struct { - - // A list of node selector requirements by node's labels. - MatchExpressions []*NodeSelectorTermMatchExpressionsItems0 `json:"matchExpressions"` - - // A list of node selector requirements by node's fields. - MatchFields []*NodeSelectorTermMatchFieldsItems0 `json:"matchFields"` -} - -// Validate validates this node selector term -func (m *NodeSelectorTerm) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateMatchExpressions(formats); err != nil { - res = append(res, err) - } - - if err := m.validateMatchFields(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *NodeSelectorTerm) validateMatchExpressions(formats strfmt.Registry) error { - if swag.IsZero(m.MatchExpressions) { // not required - return nil - } - - for i := 0; i < len(m.MatchExpressions); i++ { - if swag.IsZero(m.MatchExpressions[i]) { // not required - continue - } - - if m.MatchExpressions[i] != nil { - if err := m.MatchExpressions[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("matchExpressions" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("matchExpressions" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *NodeSelectorTerm) validateMatchFields(formats strfmt.Registry) error { - if swag.IsZero(m.MatchFields) { // not required - return nil - } - - for i := 0; i < len(m.MatchFields); i++ { - if swag.IsZero(m.MatchFields[i]) { // not required - continue - } - - if m.MatchFields[i] != nil { - if err := m.MatchFields[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("matchFields" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("matchFields" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this node selector term based on the context it is used -func (m *NodeSelectorTerm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateMatchExpressions(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateMatchFields(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *NodeSelectorTerm) contextValidateMatchExpressions(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.MatchExpressions); i++ { - - if m.MatchExpressions[i] != nil { - if err := m.MatchExpressions[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("matchExpressions" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("matchExpressions" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *NodeSelectorTerm) contextValidateMatchFields(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.MatchFields); i++ { - - if m.MatchFields[i] != nil { - if err := m.MatchFields[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("matchFields" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("matchFields" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *NodeSelectorTerm) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *NodeSelectorTerm) UnmarshalBinary(b []byte) error { - var res NodeSelectorTerm - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// NodeSelectorTermMatchExpressionsItems0 A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values. -// -// swagger:model NodeSelectorTermMatchExpressionsItems0 -type NodeSelectorTermMatchExpressionsItems0 struct { - - // The label key that the selector applies to. - // Required: true - Key *string `json:"key"` - - // Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. - // Required: true - Operator *string `json:"operator"` - - // An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch. - Values []string `json:"values"` -} - -// Validate validates this node selector term match expressions items0 -func (m *NodeSelectorTermMatchExpressionsItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateKey(formats); err != nil { - res = append(res, err) - } - - if err := m.validateOperator(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *NodeSelectorTermMatchExpressionsItems0) validateKey(formats strfmt.Registry) error { - - if err := validate.Required("key", "body", m.Key); err != nil { - return err - } - - return nil -} - -func (m *NodeSelectorTermMatchExpressionsItems0) validateOperator(formats strfmt.Registry) error { - - if err := validate.Required("operator", "body", m.Operator); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this node selector term match expressions items0 based on context it is used -func (m *NodeSelectorTermMatchExpressionsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *NodeSelectorTermMatchExpressionsItems0) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *NodeSelectorTermMatchExpressionsItems0) UnmarshalBinary(b []byte) error { - var res NodeSelectorTermMatchExpressionsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// NodeSelectorTermMatchFieldsItems0 A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values. -// -// swagger:model NodeSelectorTermMatchFieldsItems0 -type NodeSelectorTermMatchFieldsItems0 struct { - - // The label key that the selector applies to. - // Required: true - Key *string `json:"key"` - - // Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. - // Required: true - Operator *string `json:"operator"` - - // An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch. - Values []string `json:"values"` -} - -// Validate validates this node selector term match fields items0 -func (m *NodeSelectorTermMatchFieldsItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateKey(formats); err != nil { - res = append(res, err) - } - - if err := m.validateOperator(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *NodeSelectorTermMatchFieldsItems0) validateKey(formats strfmt.Registry) error { - - if err := validate.Required("key", "body", m.Key); err != nil { - return err - } - - return nil -} - -func (m *NodeSelectorTermMatchFieldsItems0) validateOperator(formats strfmt.Registry) error { - - if err := validate.Required("operator", "body", m.Operator); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this node selector term match fields items0 based on context it is used -func (m *NodeSelectorTermMatchFieldsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *NodeSelectorTermMatchFieldsItems0) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *NodeSelectorTermMatchFieldsItems0) UnmarshalBinary(b []byte) error { - var res NodeSelectorTermMatchFieldsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/operator_session_response.go b/models/operator_session_response.go deleted file mode 100644 index 49d2a9943..000000000 --- a/models/operator_session_response.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// OperatorSessionResponse operator session response -// -// swagger:model operatorSessionResponse -type OperatorSessionResponse struct { - - // direct p v - DirectPV bool `json:"directPV,omitempty"` - - // features - Features []string `json:"features"` - - // operator - Operator bool `json:"operator,omitempty"` - - // permissions - Permissions map[string][]string `json:"permissions,omitempty"` - - // status - // Enum: [ok] - Status string `json:"status,omitempty"` -} - -// Validate validates this operator session response -func (m *OperatorSessionResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateStatus(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var operatorSessionResponseTypeStatusPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["ok"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - operatorSessionResponseTypeStatusPropEnum = append(operatorSessionResponseTypeStatusPropEnum, v) - } -} - -const ( - - // OperatorSessionResponseStatusOk captures enum value "ok" - OperatorSessionResponseStatusOk string = "ok" -) - -// prop value enum -func (m *OperatorSessionResponse) validateStatusEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, operatorSessionResponseTypeStatusPropEnum, true); err != nil { - return err - } - return nil -} - -func (m *OperatorSessionResponse) validateStatus(formats strfmt.Registry) error { - if swag.IsZero(m.Status) { // not required - return nil - } - - // value enum - if err := m.validateStatusEnum("status", "body", m.Status); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this operator session response based on context it is used -func (m *OperatorSessionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *OperatorSessionResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *OperatorSessionResponse) UnmarshalBinary(b []byte) error { - var res OperatorSessionResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/operator_subnet_api_key.go b/models/operator_subnet_api_key.go deleted file mode 100644 index a165853e8..000000000 --- a/models/operator_subnet_api_key.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// OperatorSubnetAPIKey operator subnet API key -// -// swagger:model operatorSubnetAPIKey -type OperatorSubnetAPIKey struct { - - // api key - APIKey string `json:"apiKey,omitempty"` -} - -// Validate validates this operator subnet API key -func (m *OperatorSubnetAPIKey) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this operator subnet API key based on context it is used -func (m *OperatorSubnetAPIKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *OperatorSubnetAPIKey) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *OperatorSubnetAPIKey) UnmarshalBinary(b []byte) error { - var res OperatorSubnetAPIKey - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/operator_subnet_login_m_f_a_request.go b/models/operator_subnet_login_m_f_a_request.go deleted file mode 100644 index 96d57f96e..000000000 --- a/models/operator_subnet_login_m_f_a_request.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// OperatorSubnetLoginMFARequest operator subnet login m f a request -// -// swagger:model operatorSubnetLoginMFARequest -type OperatorSubnetLoginMFARequest struct { - - // mfa token - // Required: true - MfaToken *string `json:"mfa_token"` - - // otp - // Required: true - Otp *string `json:"otp"` - - // username - // Required: true - Username *string `json:"username"` -} - -// Validate validates this operator subnet login m f a request -func (m *OperatorSubnetLoginMFARequest) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateMfaToken(formats); err != nil { - res = append(res, err) - } - - if err := m.validateOtp(formats); err != nil { - res = append(res, err) - } - - if err := m.validateUsername(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *OperatorSubnetLoginMFARequest) validateMfaToken(formats strfmt.Registry) error { - - if err := validate.Required("mfa_token", "body", m.MfaToken); err != nil { - return err - } - - return nil -} - -func (m *OperatorSubnetLoginMFARequest) validateOtp(formats strfmt.Registry) error { - - if err := validate.Required("otp", "body", m.Otp); err != nil { - return err - } - - return nil -} - -func (m *OperatorSubnetLoginMFARequest) validateUsername(formats strfmt.Registry) error { - - if err := validate.Required("username", "body", m.Username); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this operator subnet login m f a request based on context it is used -func (m *OperatorSubnetLoginMFARequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *OperatorSubnetLoginMFARequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *OperatorSubnetLoginMFARequest) UnmarshalBinary(b []byte) error { - var res OperatorSubnetLoginMFARequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/operator_subnet_login_request.go b/models/operator_subnet_login_request.go deleted file mode 100644 index 3e47b8166..000000000 --- a/models/operator_subnet_login_request.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// OperatorSubnetLoginRequest operator subnet login request -// -// swagger:model operatorSubnetLoginRequest -type OperatorSubnetLoginRequest struct { - - // password - Password string `json:"password,omitempty"` - - // username - Username string `json:"username,omitempty"` -} - -// Validate validates this operator subnet login request -func (m *OperatorSubnetLoginRequest) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this operator subnet login request based on context it is used -func (m *OperatorSubnetLoginRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *OperatorSubnetLoginRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *OperatorSubnetLoginRequest) UnmarshalBinary(b []byte) error { - var res OperatorSubnetLoginRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/operator_subnet_login_response.go b/models/operator_subnet_login_response.go deleted file mode 100644 index a9d8e5016..000000000 --- a/models/operator_subnet_login_response.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// OperatorSubnetLoginResponse operator subnet login response -// -// swagger:model operatorSubnetLoginResponse -type OperatorSubnetLoginResponse struct { - - // access token - AccessToken string `json:"access_token,omitempty"` - - // mfa token - MfaToken string `json:"mfa_token,omitempty"` -} - -// Validate validates this operator subnet login response -func (m *OperatorSubnetLoginResponse) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this operator subnet login response based on context it is used -func (m *OperatorSubnetLoginResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *OperatorSubnetLoginResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *OperatorSubnetLoginResponse) UnmarshalBinary(b []byte) error { - var res OperatorSubnetLoginResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/operator_subnet_register_api_key_response.go b/models/operator_subnet_register_api_key_response.go deleted file mode 100644 index a94833fc4..000000000 --- a/models/operator_subnet_register_api_key_response.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// OperatorSubnetRegisterAPIKeyResponse operator subnet register API key response -// -// swagger:model operatorSubnetRegisterAPIKeyResponse -type OperatorSubnetRegisterAPIKeyResponse struct { - - // registered - Registered bool `json:"registered,omitempty"` -} - -// Validate validates this operator subnet register API key response -func (m *OperatorSubnetRegisterAPIKeyResponse) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this operator subnet register API key response based on context it is used -func (m *OperatorSubnetRegisterAPIKeyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *OperatorSubnetRegisterAPIKeyResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *OperatorSubnetRegisterAPIKeyResponse) UnmarshalBinary(b []byte) error { - var res OperatorSubnetRegisterAPIKeyResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/parity_response.go b/models/parity_response.go deleted file mode 100644 index 64009f5b6..000000000 --- a/models/parity_response.go +++ /dev/null @@ -1,44 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" -) - -// ParityResponse parity response -// -// swagger:model parityResponse -type ParityResponse []string - -// Validate validates this parity response -func (m ParityResponse) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this parity response based on context it is used -func (m ParityResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/models/pod_affinity_term.go b/models/pod_affinity_term.go deleted file mode 100644 index 9061cf5a6..000000000 --- a/models/pod_affinity_term.go +++ /dev/null @@ -1,323 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// PodAffinityTerm Required. A pod affinity term, associated with the corresponding weight. -// -// swagger:model podAffinityTerm -type PodAffinityTerm struct { - - // label selector - LabelSelector *PodAffinityTermLabelSelector `json:"labelSelector,omitempty"` - - // namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means "this pod's namespace" - Namespaces []string `json:"namespaces"` - - // This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed. - // Required: true - TopologyKey *string `json:"topologyKey"` -} - -// Validate validates this pod affinity term -func (m *PodAffinityTerm) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateLabelSelector(formats); err != nil { - res = append(res, err) - } - - if err := m.validateTopologyKey(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PodAffinityTerm) validateLabelSelector(formats strfmt.Registry) error { - if swag.IsZero(m.LabelSelector) { // not required - return nil - } - - if m.LabelSelector != nil { - if err := m.LabelSelector.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("labelSelector") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("labelSelector") - } - return err - } - } - - return nil -} - -func (m *PodAffinityTerm) validateTopologyKey(formats strfmt.Registry) error { - - if err := validate.Required("topologyKey", "body", m.TopologyKey); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this pod affinity term based on the context it is used -func (m *PodAffinityTerm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateLabelSelector(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PodAffinityTerm) contextValidateLabelSelector(ctx context.Context, formats strfmt.Registry) error { - - if m.LabelSelector != nil { - if err := m.LabelSelector.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("labelSelector") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("labelSelector") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *PodAffinityTerm) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PodAffinityTerm) UnmarshalBinary(b []byte) error { - var res PodAffinityTerm - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// PodAffinityTermLabelSelector A label query over a set of resources, in this case pods. -// -// swagger:model PodAffinityTermLabelSelector -type PodAffinityTermLabelSelector struct { - - // matchExpressions is a list of label selector requirements. The requirements are ANDed. - MatchExpressions []*PodAffinityTermLabelSelectorMatchExpressionsItems0 `json:"matchExpressions"` - - // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - MatchLabels map[string]string `json:"matchLabels,omitempty"` -} - -// Validate validates this pod affinity term label selector -func (m *PodAffinityTermLabelSelector) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateMatchExpressions(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PodAffinityTermLabelSelector) validateMatchExpressions(formats strfmt.Registry) error { - if swag.IsZero(m.MatchExpressions) { // not required - return nil - } - - for i := 0; i < len(m.MatchExpressions); i++ { - if swag.IsZero(m.MatchExpressions[i]) { // not required - continue - } - - if m.MatchExpressions[i] != nil { - if err := m.MatchExpressions[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("labelSelector" + "." + "matchExpressions" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("labelSelector" + "." + "matchExpressions" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this pod affinity term label selector based on the context it is used -func (m *PodAffinityTermLabelSelector) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateMatchExpressions(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PodAffinityTermLabelSelector) contextValidateMatchExpressions(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.MatchExpressions); i++ { - - if m.MatchExpressions[i] != nil { - if err := m.MatchExpressions[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("labelSelector" + "." + "matchExpressions" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("labelSelector" + "." + "matchExpressions" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *PodAffinityTermLabelSelector) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PodAffinityTermLabelSelector) UnmarshalBinary(b []byte) error { - var res PodAffinityTermLabelSelector - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// PodAffinityTermLabelSelectorMatchExpressionsItems0 A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. -// -// swagger:model PodAffinityTermLabelSelectorMatchExpressionsItems0 -type PodAffinityTermLabelSelectorMatchExpressionsItems0 struct { - - // key is the label key that the selector applies to. - // Required: true - Key *string `json:"key"` - - // operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - // Required: true - Operator *string `json:"operator"` - - // values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - Values []string `json:"values"` -} - -// Validate validates this pod affinity term label selector match expressions items0 -func (m *PodAffinityTermLabelSelectorMatchExpressionsItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateKey(formats); err != nil { - res = append(res, err) - } - - if err := m.validateOperator(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PodAffinityTermLabelSelectorMatchExpressionsItems0) validateKey(formats strfmt.Registry) error { - - if err := validate.Required("key", "body", m.Key); err != nil { - return err - } - - return nil -} - -func (m *PodAffinityTermLabelSelectorMatchExpressionsItems0) validateOperator(formats strfmt.Registry) error { - - if err := validate.Required("operator", "body", m.Operator); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this pod affinity term label selector match expressions items0 based on context it is used -func (m *PodAffinityTermLabelSelectorMatchExpressionsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *PodAffinityTermLabelSelectorMatchExpressionsItems0) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PodAffinityTermLabelSelectorMatchExpressionsItems0) UnmarshalBinary(b []byte) error { - var res PodAffinityTermLabelSelectorMatchExpressionsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/pool.go b/models/pool.go deleted file mode 100644 index e889a67e7..000000000 --- a/models/pool.go +++ /dev/null @@ -1,412 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// Pool pool -// -// swagger:model pool -type Pool struct { - - // affinity - Affinity *PoolAffinity `json:"affinity,omitempty"` - - // name - Name string `json:"name,omitempty"` - - // NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ - NodeSelector map[string]string `json:"node_selector,omitempty"` - - // resources - Resources *PoolResources `json:"resources,omitempty"` - - // runtime class name - RuntimeClassName string `json:"runtimeClassName,omitempty"` - - // security context - SecurityContext *SecurityContext `json:"securityContext,omitempty"` - - // servers - // Required: true - Servers *int64 `json:"servers"` - - // tolerations - Tolerations PoolTolerations `json:"tolerations,omitempty"` - - // volume configuration - // Required: true - VolumeConfiguration *PoolVolumeConfiguration `json:"volume_configuration"` - - // volumes per server - // Required: true - VolumesPerServer *int32 `json:"volumes_per_server"` -} - -// Validate validates this pool -func (m *Pool) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAffinity(formats); err != nil { - res = append(res, err) - } - - if err := m.validateResources(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSecurityContext(formats); err != nil { - res = append(res, err) - } - - if err := m.validateServers(formats); err != nil { - res = append(res, err) - } - - if err := m.validateTolerations(formats); err != nil { - res = append(res, err) - } - - if err := m.validateVolumeConfiguration(formats); err != nil { - res = append(res, err) - } - - if err := m.validateVolumesPerServer(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Pool) validateAffinity(formats strfmt.Registry) error { - if swag.IsZero(m.Affinity) { // not required - return nil - } - - if m.Affinity != nil { - if err := m.Affinity.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("affinity") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("affinity") - } - return err - } - } - - return nil -} - -func (m *Pool) validateResources(formats strfmt.Registry) error { - if swag.IsZero(m.Resources) { // not required - return nil - } - - if m.Resources != nil { - if err := m.Resources.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("resources") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("resources") - } - return err - } - } - - return nil -} - -func (m *Pool) validateSecurityContext(formats strfmt.Registry) error { - if swag.IsZero(m.SecurityContext) { // not required - return nil - } - - if m.SecurityContext != nil { - if err := m.SecurityContext.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("securityContext") - } - return err - } - } - - return nil -} - -func (m *Pool) validateServers(formats strfmt.Registry) error { - - if err := validate.Required("servers", "body", m.Servers); err != nil { - return err - } - - return nil -} - -func (m *Pool) validateTolerations(formats strfmt.Registry) error { - if swag.IsZero(m.Tolerations) { // not required - return nil - } - - if err := m.Tolerations.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("tolerations") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("tolerations") - } - return err - } - - return nil -} - -func (m *Pool) validateVolumeConfiguration(formats strfmt.Registry) error { - - if err := validate.Required("volume_configuration", "body", m.VolumeConfiguration); err != nil { - return err - } - - if m.VolumeConfiguration != nil { - if err := m.VolumeConfiguration.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("volume_configuration") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("volume_configuration") - } - return err - } - } - - return nil -} - -func (m *Pool) validateVolumesPerServer(formats strfmt.Registry) error { - - if err := validate.Required("volumes_per_server", "body", m.VolumesPerServer); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this pool based on the context it is used -func (m *Pool) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateAffinity(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateResources(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateSecurityContext(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateTolerations(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateVolumeConfiguration(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Pool) contextValidateAffinity(ctx context.Context, formats strfmt.Registry) error { - - if m.Affinity != nil { - if err := m.Affinity.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("affinity") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("affinity") - } - return err - } - } - - return nil -} - -func (m *Pool) contextValidateResources(ctx context.Context, formats strfmt.Registry) error { - - if m.Resources != nil { - if err := m.Resources.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("resources") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("resources") - } - return err - } - } - - return nil -} - -func (m *Pool) contextValidateSecurityContext(ctx context.Context, formats strfmt.Registry) error { - - if m.SecurityContext != nil { - if err := m.SecurityContext.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("securityContext") - } - return err - } - } - - return nil -} - -func (m *Pool) contextValidateTolerations(ctx context.Context, formats strfmt.Registry) error { - - if err := m.Tolerations.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("tolerations") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("tolerations") - } - return err - } - - return nil -} - -func (m *Pool) contextValidateVolumeConfiguration(ctx context.Context, formats strfmt.Registry) error { - - if m.VolumeConfiguration != nil { - if err := m.VolumeConfiguration.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("volume_configuration") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("volume_configuration") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *Pool) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *Pool) UnmarshalBinary(b []byte) error { - var res Pool - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// PoolVolumeConfiguration pool volume configuration -// -// swagger:model PoolVolumeConfiguration -type PoolVolumeConfiguration struct { - - // annotations - Annotations map[string]string `json:"annotations,omitempty"` - - // labels - Labels map[string]string `json:"labels,omitempty"` - - // size - // Required: true - Size *int64 `json:"size"` - - // storage class name - StorageClassName string `json:"storage_class_name,omitempty"` -} - -// Validate validates this pool volume configuration -func (m *PoolVolumeConfiguration) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateSize(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolVolumeConfiguration) validateSize(formats strfmt.Registry) error { - - if err := validate.Required("volume_configuration"+"."+"size", "body", m.Size); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this pool volume configuration based on context it is used -func (m *PoolVolumeConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *PoolVolumeConfiguration) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PoolVolumeConfiguration) UnmarshalBinary(b []byte) error { - var res PoolVolumeConfiguration - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/pool_affinity.go b/models/pool_affinity.go deleted file mode 100644 index 08965be23..000000000 --- a/models/pool_affinity.go +++ /dev/null @@ -1,1108 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// PoolAffinity If specified, affinity will define the pod's scheduling constraints -// -// swagger:model poolAffinity -type PoolAffinity struct { - - // node affinity - NodeAffinity *PoolAffinityNodeAffinity `json:"nodeAffinity,omitempty"` - - // pod affinity - PodAffinity *PoolAffinityPodAffinity `json:"podAffinity,omitempty"` - - // pod anti affinity - PodAntiAffinity *PoolAffinityPodAntiAffinity `json:"podAntiAffinity,omitempty"` -} - -// Validate validates this pool affinity -func (m *PoolAffinity) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateNodeAffinity(formats); err != nil { - res = append(res, err) - } - - if err := m.validatePodAffinity(formats); err != nil { - res = append(res, err) - } - - if err := m.validatePodAntiAffinity(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolAffinity) validateNodeAffinity(formats strfmt.Registry) error { - if swag.IsZero(m.NodeAffinity) { // not required - return nil - } - - if m.NodeAffinity != nil { - if err := m.NodeAffinity.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("nodeAffinity") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("nodeAffinity") - } - return err - } - } - - return nil -} - -func (m *PoolAffinity) validatePodAffinity(formats strfmt.Registry) error { - if swag.IsZero(m.PodAffinity) { // not required - return nil - } - - if m.PodAffinity != nil { - if err := m.PodAffinity.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("podAffinity") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("podAffinity") - } - return err - } - } - - return nil -} - -func (m *PoolAffinity) validatePodAntiAffinity(formats strfmt.Registry) error { - if swag.IsZero(m.PodAntiAffinity) { // not required - return nil - } - - if m.PodAntiAffinity != nil { - if err := m.PodAntiAffinity.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("podAntiAffinity") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("podAntiAffinity") - } - return err - } - } - - return nil -} - -// ContextValidate validate this pool affinity based on the context it is used -func (m *PoolAffinity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateNodeAffinity(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidatePodAffinity(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidatePodAntiAffinity(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolAffinity) contextValidateNodeAffinity(ctx context.Context, formats strfmt.Registry) error { - - if m.NodeAffinity != nil { - if err := m.NodeAffinity.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("nodeAffinity") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("nodeAffinity") - } - return err - } - } - - return nil -} - -func (m *PoolAffinity) contextValidatePodAffinity(ctx context.Context, formats strfmt.Registry) error { - - if m.PodAffinity != nil { - if err := m.PodAffinity.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("podAffinity") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("podAffinity") - } - return err - } - } - - return nil -} - -func (m *PoolAffinity) contextValidatePodAntiAffinity(ctx context.Context, formats strfmt.Registry) error { - - if m.PodAntiAffinity != nil { - if err := m.PodAntiAffinity.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("podAntiAffinity") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("podAntiAffinity") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *PoolAffinity) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PoolAffinity) UnmarshalBinary(b []byte) error { - var res PoolAffinity - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// PoolAffinityNodeAffinity Describes node affinity scheduling rules for the pod. -// -// swagger:model PoolAffinityNodeAffinity -type PoolAffinityNodeAffinity struct { - - // The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred. - PreferredDuringSchedulingIgnoredDuringExecution []*PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 `json:"preferredDuringSchedulingIgnoredDuringExecution"` - - // required during scheduling ignored during execution - RequiredDuringSchedulingIgnoredDuringExecution *PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution `json:"requiredDuringSchedulingIgnoredDuringExecution,omitempty"` -} - -// Validate validates this pool affinity node affinity -func (m *PoolAffinityNodeAffinity) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validatePreferredDuringSchedulingIgnoredDuringExecution(formats); err != nil { - res = append(res, err) - } - - if err := m.validateRequiredDuringSchedulingIgnoredDuringExecution(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolAffinityNodeAffinity) validatePreferredDuringSchedulingIgnoredDuringExecution(formats strfmt.Registry) error { - if swag.IsZero(m.PreferredDuringSchedulingIgnoredDuringExecution) { // not required - return nil - } - - for i := 0; i < len(m.PreferredDuringSchedulingIgnoredDuringExecution); i++ { - if swag.IsZero(m.PreferredDuringSchedulingIgnoredDuringExecution[i]) { // not required - continue - } - - if m.PreferredDuringSchedulingIgnoredDuringExecution[i] != nil { - if err := m.PreferredDuringSchedulingIgnoredDuringExecution[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("nodeAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("nodeAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *PoolAffinityNodeAffinity) validateRequiredDuringSchedulingIgnoredDuringExecution(formats strfmt.Registry) error { - if swag.IsZero(m.RequiredDuringSchedulingIgnoredDuringExecution) { // not required - return nil - } - - if m.RequiredDuringSchedulingIgnoredDuringExecution != nil { - if err := m.RequiredDuringSchedulingIgnoredDuringExecution.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution") - } - return err - } - } - - return nil -} - -// ContextValidate validate this pool affinity node affinity based on the context it is used -func (m *PoolAffinityNodeAffinity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidatePreferredDuringSchedulingIgnoredDuringExecution(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateRequiredDuringSchedulingIgnoredDuringExecution(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolAffinityNodeAffinity) contextValidatePreferredDuringSchedulingIgnoredDuringExecution(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.PreferredDuringSchedulingIgnoredDuringExecution); i++ { - - if m.PreferredDuringSchedulingIgnoredDuringExecution[i] != nil { - if err := m.PreferredDuringSchedulingIgnoredDuringExecution[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("nodeAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("nodeAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *PoolAffinityNodeAffinity) contextValidateRequiredDuringSchedulingIgnoredDuringExecution(ctx context.Context, formats strfmt.Registry) error { - - if m.RequiredDuringSchedulingIgnoredDuringExecution != nil { - if err := m.RequiredDuringSchedulingIgnoredDuringExecution.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *PoolAffinityNodeAffinity) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PoolAffinityNodeAffinity) UnmarshalBinary(b []byte) error { - var res PoolAffinityNodeAffinity - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). -// -// swagger:model PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 -type PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 struct { - - // A node selector term, associated with the corresponding weight. - // Required: true - Preference *NodeSelectorTerm `json:"preference"` - - // Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100. - // Required: true - Weight *int32 `json:"weight"` -} - -// Validate validates this pool affinity node affinity preferred during scheduling ignored during execution items0 -func (m *PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validatePreference(formats); err != nil { - res = append(res, err) - } - - if err := m.validateWeight(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) validatePreference(formats strfmt.Registry) error { - - if err := validate.Required("preference", "body", m.Preference); err != nil { - return err - } - - if m.Preference != nil { - if err := m.Preference.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("preference") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("preference") - } - return err - } - } - - return nil -} - -func (m *PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) validateWeight(formats strfmt.Registry) error { - - if err := validate.Required("weight", "body", m.Weight); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this pool affinity node affinity preferred during scheduling ignored during execution items0 based on the context it is used -func (m *PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidatePreference(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) contextValidatePreference(ctx context.Context, formats strfmt.Registry) error { - - if m.Preference != nil { - if err := m.Preference.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("preference") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("preference") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) UnmarshalBinary(b []byte) error { - var res PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node. -// -// swagger:model PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution -type PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution struct { - - // Required. A list of node selector terms. The terms are ORed. - // Required: true - NodeSelectorTerms []*NodeSelectorTerm `json:"nodeSelectorTerms"` -} - -// Validate validates this pool affinity node affinity required during scheduling ignored during execution -func (m *PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateNodeSelectorTerms(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution) validateNodeSelectorTerms(formats strfmt.Registry) error { - - if err := validate.Required("nodeAffinity"+"."+"requiredDuringSchedulingIgnoredDuringExecution"+"."+"nodeSelectorTerms", "body", m.NodeSelectorTerms); err != nil { - return err - } - - for i := 0; i < len(m.NodeSelectorTerms); i++ { - if swag.IsZero(m.NodeSelectorTerms[i]) { // not required - continue - } - - if m.NodeSelectorTerms[i] != nil { - if err := m.NodeSelectorTerms[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + "nodeSelectorTerms" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + "nodeSelectorTerms" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this pool affinity node affinity required during scheduling ignored during execution based on the context it is used -func (m *PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateNodeSelectorTerms(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution) contextValidateNodeSelectorTerms(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.NodeSelectorTerms); i++ { - - if m.NodeSelectorTerms[i] != nil { - if err := m.NodeSelectorTerms[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + "nodeSelectorTerms" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + "nodeSelectorTerms" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution) UnmarshalBinary(b []byte) error { - var res PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// PoolAffinityPodAffinity Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, pool, etc. as some other pod(s)). -// -// swagger:model PoolAffinityPodAffinity -type PoolAffinityPodAffinity struct { - - // The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred. - PreferredDuringSchedulingIgnoredDuringExecution []*PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 `json:"preferredDuringSchedulingIgnoredDuringExecution"` - - // If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied. - RequiredDuringSchedulingIgnoredDuringExecution []*PodAffinityTerm `json:"requiredDuringSchedulingIgnoredDuringExecution"` -} - -// Validate validates this pool affinity pod affinity -func (m *PoolAffinityPodAffinity) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validatePreferredDuringSchedulingIgnoredDuringExecution(formats); err != nil { - res = append(res, err) - } - - if err := m.validateRequiredDuringSchedulingIgnoredDuringExecution(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolAffinityPodAffinity) validatePreferredDuringSchedulingIgnoredDuringExecution(formats strfmt.Registry) error { - if swag.IsZero(m.PreferredDuringSchedulingIgnoredDuringExecution) { // not required - return nil - } - - for i := 0; i < len(m.PreferredDuringSchedulingIgnoredDuringExecution); i++ { - if swag.IsZero(m.PreferredDuringSchedulingIgnoredDuringExecution[i]) { // not required - continue - } - - if m.PreferredDuringSchedulingIgnoredDuringExecution[i] != nil { - if err := m.PreferredDuringSchedulingIgnoredDuringExecution[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("podAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("podAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *PoolAffinityPodAffinity) validateRequiredDuringSchedulingIgnoredDuringExecution(formats strfmt.Registry) error { - if swag.IsZero(m.RequiredDuringSchedulingIgnoredDuringExecution) { // not required - return nil - } - - for i := 0; i < len(m.RequiredDuringSchedulingIgnoredDuringExecution); i++ { - if swag.IsZero(m.RequiredDuringSchedulingIgnoredDuringExecution[i]) { // not required - continue - } - - if m.RequiredDuringSchedulingIgnoredDuringExecution[i] != nil { - if err := m.RequiredDuringSchedulingIgnoredDuringExecution[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("podAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("podAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this pool affinity pod affinity based on the context it is used -func (m *PoolAffinityPodAffinity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidatePreferredDuringSchedulingIgnoredDuringExecution(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateRequiredDuringSchedulingIgnoredDuringExecution(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolAffinityPodAffinity) contextValidatePreferredDuringSchedulingIgnoredDuringExecution(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.PreferredDuringSchedulingIgnoredDuringExecution); i++ { - - if m.PreferredDuringSchedulingIgnoredDuringExecution[i] != nil { - if err := m.PreferredDuringSchedulingIgnoredDuringExecution[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("podAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("podAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *PoolAffinityPodAffinity) contextValidateRequiredDuringSchedulingIgnoredDuringExecution(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.RequiredDuringSchedulingIgnoredDuringExecution); i++ { - - if m.RequiredDuringSchedulingIgnoredDuringExecution[i] != nil { - if err := m.RequiredDuringSchedulingIgnoredDuringExecution[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("podAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("podAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *PoolAffinityPodAffinity) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PoolAffinityPodAffinity) UnmarshalBinary(b []byte) error { - var res PoolAffinityPodAffinity - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s) -// -// swagger:model PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 -type PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 struct { - - // pod affinity term - // Required: true - PodAffinityTerm *PodAffinityTerm `json:"podAffinityTerm"` - - // weight associated with matching the corresponding podAffinityTerm, in the range 1-100. - // Required: true - Weight *int32 `json:"weight"` -} - -// Validate validates this pool affinity pod affinity preferred during scheduling ignored during execution items0 -func (m *PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validatePodAffinityTerm(formats); err != nil { - res = append(res, err) - } - - if err := m.validateWeight(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) validatePodAffinityTerm(formats strfmt.Registry) error { - - if err := validate.Required("podAffinityTerm", "body", m.PodAffinityTerm); err != nil { - return err - } - - if m.PodAffinityTerm != nil { - if err := m.PodAffinityTerm.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("podAffinityTerm") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("podAffinityTerm") - } - return err - } - } - - return nil -} - -func (m *PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) validateWeight(formats strfmt.Registry) error { - - if err := validate.Required("weight", "body", m.Weight); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this pool affinity pod affinity preferred during scheduling ignored during execution items0 based on the context it is used -func (m *PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidatePodAffinityTerm(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) contextValidatePodAffinityTerm(ctx context.Context, formats strfmt.Registry) error { - - if m.PodAffinityTerm != nil { - if err := m.PodAffinityTerm.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("podAffinityTerm") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("podAffinityTerm") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) UnmarshalBinary(b []byte) error { - var res PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// PoolAffinityPodAntiAffinity Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, pool, etc. as some other pod(s)). -// -// swagger:model PoolAffinityPodAntiAffinity -type PoolAffinityPodAntiAffinity struct { - - // The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred. - PreferredDuringSchedulingIgnoredDuringExecution []*PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 `json:"preferredDuringSchedulingIgnoredDuringExecution"` - - // If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied. - RequiredDuringSchedulingIgnoredDuringExecution []*PodAffinityTerm `json:"requiredDuringSchedulingIgnoredDuringExecution"` -} - -// Validate validates this pool affinity pod anti affinity -func (m *PoolAffinityPodAntiAffinity) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validatePreferredDuringSchedulingIgnoredDuringExecution(formats); err != nil { - res = append(res, err) - } - - if err := m.validateRequiredDuringSchedulingIgnoredDuringExecution(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolAffinityPodAntiAffinity) validatePreferredDuringSchedulingIgnoredDuringExecution(formats strfmt.Registry) error { - if swag.IsZero(m.PreferredDuringSchedulingIgnoredDuringExecution) { // not required - return nil - } - - for i := 0; i < len(m.PreferredDuringSchedulingIgnoredDuringExecution); i++ { - if swag.IsZero(m.PreferredDuringSchedulingIgnoredDuringExecution[i]) { // not required - continue - } - - if m.PreferredDuringSchedulingIgnoredDuringExecution[i] != nil { - if err := m.PreferredDuringSchedulingIgnoredDuringExecution[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("podAntiAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("podAntiAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *PoolAffinityPodAntiAffinity) validateRequiredDuringSchedulingIgnoredDuringExecution(formats strfmt.Registry) error { - if swag.IsZero(m.RequiredDuringSchedulingIgnoredDuringExecution) { // not required - return nil - } - - for i := 0; i < len(m.RequiredDuringSchedulingIgnoredDuringExecution); i++ { - if swag.IsZero(m.RequiredDuringSchedulingIgnoredDuringExecution[i]) { // not required - continue - } - - if m.RequiredDuringSchedulingIgnoredDuringExecution[i] != nil { - if err := m.RequiredDuringSchedulingIgnoredDuringExecution[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("podAntiAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("podAntiAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this pool affinity pod anti affinity based on the context it is used -func (m *PoolAffinityPodAntiAffinity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidatePreferredDuringSchedulingIgnoredDuringExecution(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateRequiredDuringSchedulingIgnoredDuringExecution(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolAffinityPodAntiAffinity) contextValidatePreferredDuringSchedulingIgnoredDuringExecution(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.PreferredDuringSchedulingIgnoredDuringExecution); i++ { - - if m.PreferredDuringSchedulingIgnoredDuringExecution[i] != nil { - if err := m.PreferredDuringSchedulingIgnoredDuringExecution[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("podAntiAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("podAntiAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *PoolAffinityPodAntiAffinity) contextValidateRequiredDuringSchedulingIgnoredDuringExecution(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.RequiredDuringSchedulingIgnoredDuringExecution); i++ { - - if m.RequiredDuringSchedulingIgnoredDuringExecution[i] != nil { - if err := m.RequiredDuringSchedulingIgnoredDuringExecution[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("podAntiAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("podAntiAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *PoolAffinityPodAntiAffinity) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PoolAffinityPodAntiAffinity) UnmarshalBinary(b []byte) error { - var res PoolAffinityPodAntiAffinity - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s) -// -// swagger:model PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 -type PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 struct { - - // pod affinity term - // Required: true - PodAffinityTerm *PodAffinityTerm `json:"podAffinityTerm"` - - // weight associated with matching the corresponding podAffinityTerm, in the range 1-100. - // Required: true - Weight *int32 `json:"weight"` -} - -// Validate validates this pool affinity pod anti affinity preferred during scheduling ignored during execution items0 -func (m *PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validatePodAffinityTerm(formats); err != nil { - res = append(res, err) - } - - if err := m.validateWeight(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) validatePodAffinityTerm(formats strfmt.Registry) error { - - if err := validate.Required("podAffinityTerm", "body", m.PodAffinityTerm); err != nil { - return err - } - - if m.PodAffinityTerm != nil { - if err := m.PodAffinityTerm.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("podAffinityTerm") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("podAffinityTerm") - } - return err - } - } - - return nil -} - -func (m *PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) validateWeight(formats strfmt.Registry) error { - - if err := validate.Required("weight", "body", m.Weight); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this pool affinity pod anti affinity preferred during scheduling ignored during execution items0 based on the context it is used -func (m *PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidatePodAffinityTerm(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) contextValidatePodAffinityTerm(ctx context.Context, formats strfmt.Registry) error { - - if m.PodAffinityTerm != nil { - if err := m.PodAffinityTerm.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("podAffinityTerm") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("podAffinityTerm") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) UnmarshalBinary(b []byte) error { - var res PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/pool_resources.go b/models/pool_resources.go deleted file mode 100644 index 974710df2..000000000 --- a/models/pool_resources.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// PoolResources If provided, use these requests and limit for cpu/memory resource allocation -// -// swagger:model poolResources -type PoolResources struct { - - // Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ - Limits map[string]int64 `json:"limits,omitempty"` - - // Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ - Requests map[string]int64 `json:"requests,omitempty"` -} - -// Validate validates this pool resources -func (m *PoolResources) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this pool resources based on context it is used -func (m *PoolResources) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *PoolResources) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PoolResources) UnmarshalBinary(b []byte) error { - var res PoolResources - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/pool_toleration_seconds.go b/models/pool_toleration_seconds.go deleted file mode 100644 index f48a03e34..000000000 --- a/models/pool_toleration_seconds.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// PoolTolerationSeconds TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system. -// -// swagger:model poolTolerationSeconds -type PoolTolerationSeconds struct { - - // seconds - // Required: true - Seconds *int64 `json:"seconds"` -} - -// Validate validates this pool toleration seconds -func (m *PoolTolerationSeconds) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateSeconds(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolTolerationSeconds) validateSeconds(formats strfmt.Registry) error { - - if err := validate.Required("seconds", "body", m.Seconds); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this pool toleration seconds based on context it is used -func (m *PoolTolerationSeconds) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *PoolTolerationSeconds) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PoolTolerationSeconds) UnmarshalBinary(b []byte) error { - var res PoolTolerationSeconds - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/pool_tolerations.go b/models/pool_tolerations.go deleted file mode 100644 index 810734b1d..000000000 --- a/models/pool_tolerations.go +++ /dev/null @@ -1,192 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// PoolTolerations Tolerations allows users to set entries like effect, key, operator, value. -// -// swagger:model poolTolerations -type PoolTolerations []*PoolTolerationsItems0 - -// Validate validates this pool tolerations -func (m PoolTolerations) Validate(formats strfmt.Registry) error { - var res []error - - for i := 0; i < len(m); i++ { - if swag.IsZero(m[i]) { // not required - continue - } - - if m[i] != nil { - if err := m[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName(strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName(strconv.Itoa(i)) - } - return err - } - } - - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// ContextValidate validate this pool tolerations based on the context it is used -func (m PoolTolerations) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - for i := 0; i < len(m); i++ { - - if m[i] != nil { - if err := m[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName(strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName(strconv.Itoa(i)) - } - return err - } - } - - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// PoolTolerationsItems0 The pod this Toleration is attached to tolerates any taint that matches the triple using the matching operator . -// -// swagger:model PoolTolerationsItems0 -type PoolTolerationsItems0 struct { - - // Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. - Effect string `json:"effect,omitempty"` - - // Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys. - Key string `json:"key,omitempty"` - - // Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category. - Operator string `json:"operator,omitempty"` - - // toleration seconds - TolerationSeconds *PoolTolerationSeconds `json:"tolerationSeconds,omitempty"` - - // Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string. - Value string `json:"value,omitempty"` -} - -// Validate validates this pool tolerations items0 -func (m *PoolTolerationsItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateTolerationSeconds(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolTolerationsItems0) validateTolerationSeconds(formats strfmt.Registry) error { - if swag.IsZero(m.TolerationSeconds) { // not required - return nil - } - - if m.TolerationSeconds != nil { - if err := m.TolerationSeconds.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("tolerationSeconds") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("tolerationSeconds") - } - return err - } - } - - return nil -} - -// ContextValidate validate this pool tolerations items0 based on the context it is used -func (m *PoolTolerationsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateTolerationSeconds(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolTolerationsItems0) contextValidateTolerationSeconds(ctx context.Context, formats strfmt.Registry) error { - - if m.TolerationSeconds != nil { - if err := m.TolerationSeconds.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("tolerationSeconds") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("tolerationSeconds") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *PoolTolerationsItems0) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PoolTolerationsItems0) UnmarshalBinary(b []byte) error { - var res PoolTolerationsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/pool_update_request.go b/models/pool_update_request.go deleted file mode 100644 index defb29624..000000000 --- a/models/pool_update_request.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// PoolUpdateRequest pool update request -// -// swagger:model poolUpdateRequest -type PoolUpdateRequest struct { - - // pools - // Required: true - Pools []*Pool `json:"pools"` -} - -// Validate validates this pool update request -func (m *PoolUpdateRequest) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validatePools(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolUpdateRequest) validatePools(formats strfmt.Registry) error { - - if err := validate.Required("pools", "body", m.Pools); err != nil { - return err - } - - for i := 0; i < len(m.Pools); i++ { - if swag.IsZero(m.Pools[i]) { // not required - continue - } - - if m.Pools[i] != nil { - if err := m.Pools[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("pools" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("pools" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this pool update request based on the context it is used -func (m *PoolUpdateRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidatePools(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PoolUpdateRequest) contextValidatePools(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Pools); i++ { - - if m.Pools[i] != nil { - if err := m.Pools[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("pools" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("pools" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *PoolUpdateRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PoolUpdateRequest) UnmarshalBinary(b []byte) error { - var res PoolUpdateRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/projected_volume.go b/models/projected_volume.go deleted file mode 100644 index 93f4abaed..000000000 --- a/models/projected_volume.go +++ /dev/null @@ -1,133 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// ProjectedVolume projected volume -// -// swagger:model projectedVolume -type ProjectedVolume struct { - - // sources - Sources []*ProjectedVolumeSource `json:"sources"` -} - -// Validate validates this projected volume -func (m *ProjectedVolume) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateSources(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ProjectedVolume) validateSources(formats strfmt.Registry) error { - if swag.IsZero(m.Sources) { // not required - return nil - } - - for i := 0; i < len(m.Sources); i++ { - if swag.IsZero(m.Sources[i]) { // not required - continue - } - - if m.Sources[i] != nil { - if err := m.Sources[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("sources" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("sources" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this projected volume based on the context it is used -func (m *ProjectedVolume) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateSources(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ProjectedVolume) contextValidateSources(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Sources); i++ { - - if m.Sources[i] != nil { - if err := m.Sources[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("sources" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("sources" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *ProjectedVolume) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ProjectedVolume) UnmarshalBinary(b []byte) error { - var res ProjectedVolume - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/projected_volume_source.go b/models/projected_volume_source.go deleted file mode 100644 index cb0161494..000000000 --- a/models/projected_volume_source.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// ProjectedVolumeSource projected volume source -// -// swagger:model projectedVolumeSource -type ProjectedVolumeSource struct { - - // config map - ConfigMap *ConfigMap `json:"configMap,omitempty"` - - // downward Api - DownwardAPI bool `json:"downwardApi,omitempty"` - - // secret - Secret *Secret `json:"secret,omitempty"` - - // service account token - ServiceAccountToken *ServiceAccountToken `json:"serviceAccountToken,omitempty"` -} - -// Validate validates this projected volume source -func (m *ProjectedVolumeSource) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateConfigMap(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSecret(formats); err != nil { - res = append(res, err) - } - - if err := m.validateServiceAccountToken(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ProjectedVolumeSource) validateConfigMap(formats strfmt.Registry) error { - if swag.IsZero(m.ConfigMap) { // not required - return nil - } - - if m.ConfigMap != nil { - if err := m.ConfigMap.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("configMap") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("configMap") - } - return err - } - } - - return nil -} - -func (m *ProjectedVolumeSource) validateSecret(formats strfmt.Registry) error { - if swag.IsZero(m.Secret) { // not required - return nil - } - - if m.Secret != nil { - if err := m.Secret.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("secret") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("secret") - } - return err - } - } - - return nil -} - -func (m *ProjectedVolumeSource) validateServiceAccountToken(formats strfmt.Registry) error { - if swag.IsZero(m.ServiceAccountToken) { // not required - return nil - } - - if m.ServiceAccountToken != nil { - if err := m.ServiceAccountToken.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("serviceAccountToken") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("serviceAccountToken") - } - return err - } - } - - return nil -} - -// ContextValidate validate this projected volume source based on the context it is used -func (m *ProjectedVolumeSource) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateConfigMap(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateSecret(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateServiceAccountToken(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ProjectedVolumeSource) contextValidateConfigMap(ctx context.Context, formats strfmt.Registry) error { - - if m.ConfigMap != nil { - if err := m.ConfigMap.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("configMap") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("configMap") - } - return err - } - } - - return nil -} - -func (m *ProjectedVolumeSource) contextValidateSecret(ctx context.Context, formats strfmt.Registry) error { - - if m.Secret != nil { - if err := m.Secret.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("secret") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("secret") - } - return err - } - } - - return nil -} - -func (m *ProjectedVolumeSource) contextValidateServiceAccountToken(ctx context.Context, formats strfmt.Registry) error { - - if m.ServiceAccountToken != nil { - if err := m.ServiceAccountToken.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("serviceAccountToken") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("serviceAccountToken") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *ProjectedVolumeSource) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ProjectedVolumeSource) UnmarshalBinary(b []byte) error { - var res ProjectedVolumeSource - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/prometheus_configuration.go b/models/prometheus_configuration.go deleted file mode 100644 index fdde2e230..000000000 --- a/models/prometheus_configuration.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// PrometheusConfiguration prometheus configuration -// -// swagger:model prometheusConfiguration -type PrometheusConfiguration struct { - - // image - Image string `json:"image,omitempty"` - - // init image - InitImage string `json:"init_image,omitempty"` - - // security context - SecurityContext *SecurityContext `json:"securityContext,omitempty"` - - // sidecar image - SidecarImage string `json:"sidecar_image,omitempty"` - - // storage class - StorageClass string `json:"storageClass,omitempty"` - - // storage size - StorageSize *float64 `json:"storageSize,omitempty"` -} - -// Validate validates this prometheus configuration -func (m *PrometheusConfiguration) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateSecurityContext(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PrometheusConfiguration) validateSecurityContext(formats strfmt.Registry) error { - if swag.IsZero(m.SecurityContext) { // not required - return nil - } - - if m.SecurityContext != nil { - if err := m.SecurityContext.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("securityContext") - } - return err - } - } - - return nil -} - -// ContextValidate validate this prometheus configuration based on the context it is used -func (m *PrometheusConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateSecurityContext(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PrometheusConfiguration) contextValidateSecurityContext(ctx context.Context, formats strfmt.Registry) error { - - if m.SecurityContext != nil { - if err := m.SecurityContext.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("securityContext") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *PrometheusConfiguration) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PrometheusConfiguration) UnmarshalBinary(b []byte) error { - var res PrometheusConfiguration - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/pv_format_error_response.go b/models/pv_format_error_response.go deleted file mode 100644 index 1c1cac299..000000000 --- a/models/pv_format_error_response.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// PvFormatErrorResponse pv format error response -// -// swagger:model pvFormatErrorResponse -type PvFormatErrorResponse struct { - - // drive - Drive string `json:"drive,omitempty"` - - // error - Error string `json:"error,omitempty"` - - // node - Node string `json:"node,omitempty"` -} - -// Validate validates this pv format error response -func (m *PvFormatErrorResponse) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this pv format error response based on context it is used -func (m *PvFormatErrorResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *PvFormatErrorResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PvFormatErrorResponse) UnmarshalBinary(b []byte) error { - var res PvFormatErrorResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/pvc.go b/models/pvc.go deleted file mode 100644 index 136c69fcd..000000000 --- a/models/pvc.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// Pvc pvc -// -// swagger:model pvc -type Pvc struct { - - // claim name - ClaimName string `json:"claimName,omitempty"` - - // read only - ReadOnly bool `json:"readOnly,omitempty"` -} - -// Validate validates this pvc -func (m *Pvc) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this pvc based on context it is used -func (m *Pvc) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *Pvc) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *Pvc) UnmarshalBinary(b []byte) error { - var res Pvc - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/pvcs_list_response.go b/models/pvcs_list_response.go deleted file mode 100644 index 789d18a6d..000000000 --- a/models/pvcs_list_response.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// PvcsListResponse pvcs list response -// -// swagger:model pvcsListResponse -type PvcsListResponse struct { - - // age - Age string `json:"age,omitempty"` - - // capacity - Capacity string `json:"capacity,omitempty"` - - // name - Name string `json:"name,omitempty"` - - // namespace - Namespace string `json:"namespace,omitempty"` - - // status - Status string `json:"status,omitempty"` - - // storage class - StorageClass string `json:"storageClass,omitempty"` - - // tenant - Tenant string `json:"tenant,omitempty"` - - // volume - Volume string `json:"volume,omitempty"` -} - -// Validate validates this pvcs list response -func (m *PvcsListResponse) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this pvcs list response based on context it is used -func (m *PvcsListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *PvcsListResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PvcsListResponse) UnmarshalBinary(b []byte) error { - var res PvcsListResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/resource_quota.go b/models/resource_quota.go deleted file mode 100644 index ab6dc7c53..000000000 --- a/models/resource_quota.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// ResourceQuota resource quota -// -// swagger:model resourceQuota -type ResourceQuota struct { - - // elements - Elements []*ResourceQuotaElement `json:"elements"` - - // name - Name string `json:"name,omitempty"` -} - -// Validate validates this resource quota -func (m *ResourceQuota) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateElements(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ResourceQuota) validateElements(formats strfmt.Registry) error { - if swag.IsZero(m.Elements) { // not required - return nil - } - - for i := 0; i < len(m.Elements); i++ { - if swag.IsZero(m.Elements[i]) { // not required - continue - } - - if m.Elements[i] != nil { - if err := m.Elements[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("elements" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("elements" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this resource quota based on the context it is used -func (m *ResourceQuota) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateElements(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ResourceQuota) contextValidateElements(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Elements); i++ { - - if m.Elements[i] != nil { - if err := m.Elements[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("elements" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("elements" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *ResourceQuota) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ResourceQuota) UnmarshalBinary(b []byte) error { - var res ResourceQuota - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/resource_quota_element.go b/models/resource_quota_element.go deleted file mode 100644 index 41beb82a7..000000000 --- a/models/resource_quota_element.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// ResourceQuotaElement resource quota element -// -// swagger:model resourceQuotaElement -type ResourceQuotaElement struct { - - // hard - Hard int64 `json:"hard,omitempty"` - - // name - Name string `json:"name,omitempty"` - - // used - Used int64 `json:"used,omitempty"` -} - -// Validate validates this resource quota element -func (m *ResourceQuotaElement) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this resource quota element based on context it is used -func (m *ResourceQuotaElement) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *ResourceQuotaElement) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ResourceQuotaElement) UnmarshalBinary(b []byte) error { - var res ResourceQuotaElement - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/secret.go b/models/secret.go deleted file mode 100644 index 0c4686eca..000000000 --- a/models/secret.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// Secret secret -// -// swagger:model secret -type Secret struct { - - // name - Name string `json:"name,omitempty"` - - // optional - Optional bool `json:"optional,omitempty"` -} - -// Validate validates this secret -func (m *Secret) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this secret based on context it is used -func (m *Secret) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *Secret) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *Secret) UnmarshalBinary(b []byte) error { - var res Secret - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/security_context.go b/models/security_context.go deleted file mode 100644 index 20cffbe7f..000000000 --- a/models/security_context.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// SecurityContext security context -// -// swagger:model securityContext -type SecurityContext struct { - - // fs group - FsGroup string `json:"fsGroup,omitempty"` - - // fs group change policy - FsGroupChangePolicy string `json:"fsGroupChangePolicy,omitempty"` - - // run as group - // Required: true - RunAsGroup *string `json:"runAsGroup"` - - // run as non root - // Required: true - RunAsNonRoot *bool `json:"runAsNonRoot"` - - // run as user - // Required: true - RunAsUser *string `json:"runAsUser"` -} - -// Validate validates this security context -func (m *SecurityContext) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateRunAsGroup(formats); err != nil { - res = append(res, err) - } - - if err := m.validateRunAsNonRoot(formats); err != nil { - res = append(res, err) - } - - if err := m.validateRunAsUser(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *SecurityContext) validateRunAsGroup(formats strfmt.Registry) error { - - if err := validate.Required("runAsGroup", "body", m.RunAsGroup); err != nil { - return err - } - - return nil -} - -func (m *SecurityContext) validateRunAsNonRoot(formats strfmt.Registry) error { - - if err := validate.Required("runAsNonRoot", "body", m.RunAsNonRoot); err != nil { - return err - } - - return nil -} - -func (m *SecurityContext) validateRunAsUser(formats strfmt.Registry) error { - - if err := validate.Required("runAsUser", "body", m.RunAsUser); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this security context based on context it is used -func (m *SecurityContext) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *SecurityContext) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *SecurityContext) UnmarshalBinary(b []byte) error { - var res SecurityContext - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/service_account_token.go b/models/service_account_token.go deleted file mode 100644 index dc62ce380..000000000 --- a/models/service_account_token.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// ServiceAccountToken service account token -// -// swagger:model serviceAccountToken -type ServiceAccountToken struct { - - // expiration seconds - ExpirationSeconds int64 `json:"expirationSeconds,omitempty"` -} - -// Validate validates this service account token -func (m *ServiceAccountToken) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this service account token based on context it is used -func (m *ServiceAccountToken) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *ServiceAccountToken) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ServiceAccountToken) UnmarshalBinary(b []byte) error { - var res ServiceAccountToken - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/set_administrators_request.go b/models/set_administrators_request.go deleted file mode 100644 index 9e9941858..000000000 --- a/models/set_administrators_request.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// SetAdministratorsRequest set administrators request -// -// swagger:model setAdministratorsRequest -type SetAdministratorsRequest struct { - - // group dns - GroupDNS []string `json:"group_dns"` - - // user dns - UserDNS []string `json:"user_dns"` -} - -// Validate validates this set administrators request -func (m *SetAdministratorsRequest) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this set administrators request based on context it is used -func (m *SetAdministratorsRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *SetAdministratorsRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *SetAdministratorsRequest) UnmarshalBinary(b []byte) error { - var res SetAdministratorsRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/state.go b/models/state.go deleted file mode 100644 index e17a8de1b..000000000 --- a/models/state.go +++ /dev/null @@ -1,85 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// State state -// -// swagger:model state -type State struct { - - // exit code - ExitCode int64 `json:"exitCode,omitempty"` - - // finished - Finished string `json:"finished,omitempty"` - - // message - Message string `json:"message,omitempty"` - - // reason - Reason string `json:"reason,omitempty"` - - // signal - Signal int64 `json:"signal,omitempty"` - - // started - Started string `json:"started,omitempty"` - - // state - State string `json:"state,omitempty"` -} - -// Validate validates this state -func (m *State) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this state based on context it is used -func (m *State) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *State) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *State) UnmarshalBinary(b []byte) error { - var res State - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/subscription_validate_request.go b/models/subscription_validate_request.go deleted file mode 100644 index 1d07c66cb..000000000 --- a/models/subscription_validate_request.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// SubscriptionValidateRequest subscription validate request -// -// swagger:model subscriptionValidateRequest -type SubscriptionValidateRequest struct { - - // email - Email string `json:"email,omitempty"` - - // license - License string `json:"license,omitempty"` - - // password - Password string `json:"password,omitempty"` -} - -// Validate validates this subscription validate request -func (m *SubscriptionValidateRequest) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this subscription validate request based on context it is used -func (m *SubscriptionValidateRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *SubscriptionValidateRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *SubscriptionValidateRequest) UnmarshalBinary(b []byte) error { - var res SubscriptionValidateRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tenant.go b/models/tenant.go deleted file mode 100644 index 41d21a071..000000000 --- a/models/tenant.go +++ /dev/null @@ -1,399 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// Tenant tenant -// -// swagger:model tenant -type Tenant struct { - - // creation date - CreationDate string `json:"creation_date,omitempty"` - - // current state - CurrentState string `json:"currentState,omitempty"` - - // deletion date - DeletionDate string `json:"deletion_date,omitempty"` - - // domains - Domains *DomainsConfiguration `json:"domains,omitempty"` - - // enable prometheus - EnablePrometheus bool `json:"enable_prometheus,omitempty"` - - // encryption enabled - EncryptionEnabled bool `json:"encryptionEnabled,omitempty"` - - // endpoints - Endpoints *TenantEndpoints `json:"endpoints,omitempty"` - - // idp ad enabled - IdpAdEnabled bool `json:"idpAdEnabled,omitempty"` - - // idp oidc enabled - IdpOidcEnabled bool `json:"idpOidcEnabled,omitempty"` - - // image - Image string `json:"image,omitempty"` - - // log enabled - LogEnabled bool `json:"logEnabled,omitempty"` - - // minio TLS - MinioTLS bool `json:"minioTLS,omitempty"` - - // monitoring enabled - MonitoringEnabled bool `json:"monitoringEnabled,omitempty"` - - // name - Name string `json:"name,omitempty"` - - // namespace - Namespace string `json:"namespace,omitempty"` - - // pools - Pools []*Pool `json:"pools"` - - // status - Status *TenantStatus `json:"status,omitempty"` - - // subnet license - SubnetLicense *License `json:"subnet_license,omitempty"` - - // total size - TotalSize int64 `json:"total_size,omitempty"` -} - -// Validate validates this tenant -func (m *Tenant) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateDomains(formats); err != nil { - res = append(res, err) - } - - if err := m.validateEndpoints(formats); err != nil { - res = append(res, err) - } - - if err := m.validatePools(formats); err != nil { - res = append(res, err) - } - - if err := m.validateStatus(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSubnetLicense(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Tenant) validateDomains(formats strfmt.Registry) error { - if swag.IsZero(m.Domains) { // not required - return nil - } - - if m.Domains != nil { - if err := m.Domains.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("domains") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("domains") - } - return err - } - } - - return nil -} - -func (m *Tenant) validateEndpoints(formats strfmt.Registry) error { - if swag.IsZero(m.Endpoints) { // not required - return nil - } - - if m.Endpoints != nil { - if err := m.Endpoints.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("endpoints") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("endpoints") - } - return err - } - } - - return nil -} - -func (m *Tenant) validatePools(formats strfmt.Registry) error { - if swag.IsZero(m.Pools) { // not required - return nil - } - - for i := 0; i < len(m.Pools); i++ { - if swag.IsZero(m.Pools[i]) { // not required - continue - } - - if m.Pools[i] != nil { - if err := m.Pools[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("pools" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("pools" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *Tenant) validateStatus(formats strfmt.Registry) error { - if swag.IsZero(m.Status) { // not required - return nil - } - - if m.Status != nil { - if err := m.Status.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("status") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("status") - } - return err - } - } - - return nil -} - -func (m *Tenant) validateSubnetLicense(formats strfmt.Registry) error { - if swag.IsZero(m.SubnetLicense) { // not required - return nil - } - - if m.SubnetLicense != nil { - if err := m.SubnetLicense.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("subnet_license") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("subnet_license") - } - return err - } - } - - return nil -} - -// ContextValidate validate this tenant based on the context it is used -func (m *Tenant) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateDomains(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateEndpoints(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidatePools(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateStatus(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateSubnetLicense(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Tenant) contextValidateDomains(ctx context.Context, formats strfmt.Registry) error { - - if m.Domains != nil { - if err := m.Domains.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("domains") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("domains") - } - return err - } - } - - return nil -} - -func (m *Tenant) contextValidateEndpoints(ctx context.Context, formats strfmt.Registry) error { - - if m.Endpoints != nil { - if err := m.Endpoints.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("endpoints") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("endpoints") - } - return err - } - } - - return nil -} - -func (m *Tenant) contextValidatePools(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Pools); i++ { - - if m.Pools[i] != nil { - if err := m.Pools[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("pools" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("pools" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *Tenant) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { - - if m.Status != nil { - if err := m.Status.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("status") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("status") - } - return err - } - } - - return nil -} - -func (m *Tenant) contextValidateSubnetLicense(ctx context.Context, formats strfmt.Registry) error { - - if m.SubnetLicense != nil { - if err := m.SubnetLicense.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("subnet_license") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("subnet_license") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *Tenant) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *Tenant) UnmarshalBinary(b []byte) error { - var res Tenant - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// TenantEndpoints tenant endpoints -// -// swagger:model TenantEndpoints -type TenantEndpoints struct { - - // console - Console string `json:"console,omitempty"` - - // minio - Minio string `json:"minio,omitempty"` -} - -// Validate validates this tenant endpoints -func (m *TenantEndpoints) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this tenant endpoints based on context it is used -func (m *TenantEndpoints) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *TenantEndpoints) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TenantEndpoints) UnmarshalBinary(b []byte) error { - var res TenantEndpoints - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tenant_configuration_response.go b/models/tenant_configuration_response.go deleted file mode 100644 index 8f4add51f..000000000 --- a/models/tenant_configuration_response.go +++ /dev/null @@ -1,133 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TenantConfigurationResponse tenant configuration response -// -// swagger:model tenantConfigurationResponse -type TenantConfigurationResponse struct { - - // environment variables - EnvironmentVariables []*EnvironmentVariable `json:"environmentVariables"` -} - -// Validate validates this tenant configuration response -func (m *TenantConfigurationResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateEnvironmentVariables(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TenantConfigurationResponse) validateEnvironmentVariables(formats strfmt.Registry) error { - if swag.IsZero(m.EnvironmentVariables) { // not required - return nil - } - - for i := 0; i < len(m.EnvironmentVariables); i++ { - if swag.IsZero(m.EnvironmentVariables[i]) { // not required - continue - } - - if m.EnvironmentVariables[i] != nil { - if err := m.EnvironmentVariables[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("environmentVariables" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("environmentVariables" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this tenant configuration response based on the context it is used -func (m *TenantConfigurationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateEnvironmentVariables(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TenantConfigurationResponse) contextValidateEnvironmentVariables(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.EnvironmentVariables); i++ { - - if m.EnvironmentVariables[i] != nil { - if err := m.EnvironmentVariables[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("environmentVariables" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("environmentVariables" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *TenantConfigurationResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TenantConfigurationResponse) UnmarshalBinary(b []byte) error { - var res TenantConfigurationResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tenant_list.go b/models/tenant_list.go deleted file mode 100644 index fceedad9e..000000000 --- a/models/tenant_list.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TenantList tenant list -// -// swagger:model tenantList -type TenantList struct { - - // capacity - Capacity int64 `json:"capacity,omitempty"` - - // capacity raw - CapacityRaw int64 `json:"capacity_raw,omitempty"` - - // capacity raw usage - CapacityRawUsage int64 `json:"capacity_raw_usage,omitempty"` - - // capacity usage - CapacityUsage int64 `json:"capacity_usage,omitempty"` - - // creation date - CreationDate string `json:"creation_date,omitempty"` - - // current state - CurrentState string `json:"currentState,omitempty"` - - // deletion date - DeletionDate string `json:"deletion_date,omitempty"` - - // domains - Domains *DomainsConfiguration `json:"domains,omitempty"` - - // health status - HealthStatus string `json:"health_status,omitempty"` - - // instance count - InstanceCount int64 `json:"instance_count,omitempty"` - - // name - Name string `json:"name,omitempty"` - - // namespace - Namespace string `json:"namespace,omitempty"` - - // pool count - PoolCount int64 `json:"pool_count,omitempty"` - - // tiers - Tiers []*TenantTierElement `json:"tiers"` - - // total size - TotalSize int64 `json:"total_size,omitempty"` - - // volume count - VolumeCount int64 `json:"volume_count,omitempty"` -} - -// Validate validates this tenant list -func (m *TenantList) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateDomains(formats); err != nil { - res = append(res, err) - } - - if err := m.validateTiers(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TenantList) validateDomains(formats strfmt.Registry) error { - if swag.IsZero(m.Domains) { // not required - return nil - } - - if m.Domains != nil { - if err := m.Domains.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("domains") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("domains") - } - return err - } - } - - return nil -} - -func (m *TenantList) validateTiers(formats strfmt.Registry) error { - if swag.IsZero(m.Tiers) { // not required - return nil - } - - for i := 0; i < len(m.Tiers); i++ { - if swag.IsZero(m.Tiers[i]) { // not required - continue - } - - if m.Tiers[i] != nil { - if err := m.Tiers[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("tiers" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("tiers" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this tenant list based on the context it is used -func (m *TenantList) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateDomains(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateTiers(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TenantList) contextValidateDomains(ctx context.Context, formats strfmt.Registry) error { - - if m.Domains != nil { - if err := m.Domains.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("domains") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("domains") - } - return err - } - } - - return nil -} - -func (m *TenantList) contextValidateTiers(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Tiers); i++ { - - if m.Tiers[i] != nil { - if err := m.Tiers[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("tiers" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("tiers" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *TenantList) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TenantList) UnmarshalBinary(b []byte) error { - var res TenantList - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tenant_logs.go b/models/tenant_logs.go deleted file mode 100644 index 0d8b0ef06..000000000 --- a/models/tenant_logs.go +++ /dev/null @@ -1,543 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TenantLogs tenant logs -// -// swagger:model tenantLogs -type TenantLogs struct { - - // annotations - Annotations []*Annotation `json:"annotations"` - - // db annotations - DbAnnotations []*Annotation `json:"dbAnnotations"` - - // db image - DbImage string `json:"dbImage,omitempty"` - - // db init image - DbInitImage string `json:"dbInitImage,omitempty"` - - // db labels - DbLabels []*Label `json:"dbLabels"` - - // db node selector - DbNodeSelector []*NodeSelector `json:"dbNodeSelector"` - - // db security context - DbSecurityContext *SecurityContext `json:"dbSecurityContext,omitempty"` - - // db service account name - DbServiceAccountName string `json:"dbServiceAccountName,omitempty"` - - // disabled - Disabled bool `json:"disabled,omitempty"` - - // disk capacity g b - DiskCapacityGB string `json:"diskCapacityGB,omitempty"` - - // image - Image string `json:"image,omitempty"` - - // labels - Labels []*Label `json:"labels"` - - // log CPU request - LogCPURequest string `json:"logCPURequest,omitempty"` - - // log d b CPU request - LogDBCPURequest string `json:"logDBCPURequest,omitempty"` - - // log d b mem request - LogDBMemRequest string `json:"logDBMemRequest,omitempty"` - - // log mem request - LogMemRequest string `json:"logMemRequest,omitempty"` - - // node selector - NodeSelector []*NodeSelector `json:"nodeSelector"` - - // security context - SecurityContext *SecurityContext `json:"securityContext,omitempty"` - - // service account name - ServiceAccountName string `json:"serviceAccountName,omitempty"` -} - -// Validate validates this tenant logs -func (m *TenantLogs) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAnnotations(formats); err != nil { - res = append(res, err) - } - - if err := m.validateDbAnnotations(formats); err != nil { - res = append(res, err) - } - - if err := m.validateDbLabels(formats); err != nil { - res = append(res, err) - } - - if err := m.validateDbNodeSelector(formats); err != nil { - res = append(res, err) - } - - if err := m.validateDbSecurityContext(formats); err != nil { - res = append(res, err) - } - - if err := m.validateLabels(formats); err != nil { - res = append(res, err) - } - - if err := m.validateNodeSelector(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSecurityContext(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TenantLogs) validateAnnotations(formats strfmt.Registry) error { - if swag.IsZero(m.Annotations) { // not required - return nil - } - - for i := 0; i < len(m.Annotations); i++ { - if swag.IsZero(m.Annotations[i]) { // not required - continue - } - - if m.Annotations[i] != nil { - if err := m.Annotations[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("annotations" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("annotations" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantLogs) validateDbAnnotations(formats strfmt.Registry) error { - if swag.IsZero(m.DbAnnotations) { // not required - return nil - } - - for i := 0; i < len(m.DbAnnotations); i++ { - if swag.IsZero(m.DbAnnotations[i]) { // not required - continue - } - - if m.DbAnnotations[i] != nil { - if err := m.DbAnnotations[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("dbAnnotations" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("dbAnnotations" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantLogs) validateDbLabels(formats strfmt.Registry) error { - if swag.IsZero(m.DbLabels) { // not required - return nil - } - - for i := 0; i < len(m.DbLabels); i++ { - if swag.IsZero(m.DbLabels[i]) { // not required - continue - } - - if m.DbLabels[i] != nil { - if err := m.DbLabels[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("dbLabels" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("dbLabels" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantLogs) validateDbNodeSelector(formats strfmt.Registry) error { - if swag.IsZero(m.DbNodeSelector) { // not required - return nil - } - - for i := 0; i < len(m.DbNodeSelector); i++ { - if swag.IsZero(m.DbNodeSelector[i]) { // not required - continue - } - - if m.DbNodeSelector[i] != nil { - if err := m.DbNodeSelector[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("dbNodeSelector" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("dbNodeSelector" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantLogs) validateDbSecurityContext(formats strfmt.Registry) error { - if swag.IsZero(m.DbSecurityContext) { // not required - return nil - } - - if m.DbSecurityContext != nil { - if err := m.DbSecurityContext.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("dbSecurityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("dbSecurityContext") - } - return err - } - } - - return nil -} - -func (m *TenantLogs) validateLabels(formats strfmt.Registry) error { - if swag.IsZero(m.Labels) { // not required - return nil - } - - for i := 0; i < len(m.Labels); i++ { - if swag.IsZero(m.Labels[i]) { // not required - continue - } - - if m.Labels[i] != nil { - if err := m.Labels[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("labels" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("labels" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantLogs) validateNodeSelector(formats strfmt.Registry) error { - if swag.IsZero(m.NodeSelector) { // not required - return nil - } - - for i := 0; i < len(m.NodeSelector); i++ { - if swag.IsZero(m.NodeSelector[i]) { // not required - continue - } - - if m.NodeSelector[i] != nil { - if err := m.NodeSelector[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("nodeSelector" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("nodeSelector" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantLogs) validateSecurityContext(formats strfmt.Registry) error { - if swag.IsZero(m.SecurityContext) { // not required - return nil - } - - if m.SecurityContext != nil { - if err := m.SecurityContext.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("securityContext") - } - return err - } - } - - return nil -} - -// ContextValidate validate this tenant logs based on the context it is used -func (m *TenantLogs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateAnnotations(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateDbAnnotations(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateDbLabels(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateDbNodeSelector(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateDbSecurityContext(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateLabels(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateNodeSelector(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateSecurityContext(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TenantLogs) contextValidateAnnotations(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Annotations); i++ { - - if m.Annotations[i] != nil { - if err := m.Annotations[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("annotations" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("annotations" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantLogs) contextValidateDbAnnotations(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.DbAnnotations); i++ { - - if m.DbAnnotations[i] != nil { - if err := m.DbAnnotations[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("dbAnnotations" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("dbAnnotations" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantLogs) contextValidateDbLabels(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.DbLabels); i++ { - - if m.DbLabels[i] != nil { - if err := m.DbLabels[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("dbLabels" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("dbLabels" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantLogs) contextValidateDbNodeSelector(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.DbNodeSelector); i++ { - - if m.DbNodeSelector[i] != nil { - if err := m.DbNodeSelector[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("dbNodeSelector" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("dbNodeSelector" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantLogs) contextValidateDbSecurityContext(ctx context.Context, formats strfmt.Registry) error { - - if m.DbSecurityContext != nil { - if err := m.DbSecurityContext.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("dbSecurityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("dbSecurityContext") - } - return err - } - } - - return nil -} - -func (m *TenantLogs) contextValidateLabels(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Labels); i++ { - - if m.Labels[i] != nil { - if err := m.Labels[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("labels" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("labels" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantLogs) contextValidateNodeSelector(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.NodeSelector); i++ { - - if m.NodeSelector[i] != nil { - if err := m.NodeSelector[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("nodeSelector" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("nodeSelector" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantLogs) contextValidateSecurityContext(ctx context.Context, formats strfmt.Registry) error { - - if m.SecurityContext != nil { - if err := m.SecurityContext.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("securityContext") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *TenantLogs) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TenantLogs) UnmarshalBinary(b []byte) error { - var res TenantLogs - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tenant_monitoring_info.go b/models/tenant_monitoring_info.go deleted file mode 100644 index 5c5a2821f..000000000 --- a/models/tenant_monitoring_info.go +++ /dev/null @@ -1,323 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TenantMonitoringInfo tenant monitoring info -// -// swagger:model tenantMonitoringInfo -type TenantMonitoringInfo struct { - - // annotations - Annotations []*Annotation `json:"annotations"` - - // disk capacity g b - DiskCapacityGB string `json:"diskCapacityGB,omitempty"` - - // image - Image string `json:"image,omitempty"` - - // init image - InitImage string `json:"initImage,omitempty"` - - // labels - Labels []*Label `json:"labels"` - - // monitoring CPU request - MonitoringCPURequest string `json:"monitoringCPURequest,omitempty"` - - // monitoring mem request - MonitoringMemRequest string `json:"monitoringMemRequest,omitempty"` - - // node selector - NodeSelector []*NodeSelector `json:"nodeSelector"` - - // prometheus enabled - PrometheusEnabled bool `json:"prometheusEnabled,omitempty"` - - // security context - SecurityContext *SecurityContext `json:"securityContext,omitempty"` - - // service account name - ServiceAccountName string `json:"serviceAccountName,omitempty"` - - // sidecar image - SidecarImage string `json:"sidecarImage,omitempty"` - - // storage class name - StorageClassName string `json:"storageClassName,omitempty"` - - // toggle - Toggle bool `json:"toggle,omitempty"` -} - -// Validate validates this tenant monitoring info -func (m *TenantMonitoringInfo) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAnnotations(formats); err != nil { - res = append(res, err) - } - - if err := m.validateLabels(formats); err != nil { - res = append(res, err) - } - - if err := m.validateNodeSelector(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSecurityContext(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TenantMonitoringInfo) validateAnnotations(formats strfmt.Registry) error { - if swag.IsZero(m.Annotations) { // not required - return nil - } - - for i := 0; i < len(m.Annotations); i++ { - if swag.IsZero(m.Annotations[i]) { // not required - continue - } - - if m.Annotations[i] != nil { - if err := m.Annotations[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("annotations" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("annotations" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantMonitoringInfo) validateLabels(formats strfmt.Registry) error { - if swag.IsZero(m.Labels) { // not required - return nil - } - - for i := 0; i < len(m.Labels); i++ { - if swag.IsZero(m.Labels[i]) { // not required - continue - } - - if m.Labels[i] != nil { - if err := m.Labels[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("labels" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("labels" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantMonitoringInfo) validateNodeSelector(formats strfmt.Registry) error { - if swag.IsZero(m.NodeSelector) { // not required - return nil - } - - for i := 0; i < len(m.NodeSelector); i++ { - if swag.IsZero(m.NodeSelector[i]) { // not required - continue - } - - if m.NodeSelector[i] != nil { - if err := m.NodeSelector[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("nodeSelector" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("nodeSelector" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantMonitoringInfo) validateSecurityContext(formats strfmt.Registry) error { - if swag.IsZero(m.SecurityContext) { // not required - return nil - } - - if m.SecurityContext != nil { - if err := m.SecurityContext.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("securityContext") - } - return err - } - } - - return nil -} - -// ContextValidate validate this tenant monitoring info based on the context it is used -func (m *TenantMonitoringInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateAnnotations(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateLabels(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateNodeSelector(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateSecurityContext(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TenantMonitoringInfo) contextValidateAnnotations(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Annotations); i++ { - - if m.Annotations[i] != nil { - if err := m.Annotations[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("annotations" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("annotations" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantMonitoringInfo) contextValidateLabels(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Labels); i++ { - - if m.Labels[i] != nil { - if err := m.Labels[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("labels" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("labels" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantMonitoringInfo) contextValidateNodeSelector(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.NodeSelector); i++ { - - if m.NodeSelector[i] != nil { - if err := m.NodeSelector[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("nodeSelector" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("nodeSelector" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantMonitoringInfo) contextValidateSecurityContext(ctx context.Context, formats strfmt.Registry) error { - - if m.SecurityContext != nil { - if err := m.SecurityContext.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("securityContext") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *TenantMonitoringInfo) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TenantMonitoringInfo) UnmarshalBinary(b []byte) error { - var res TenantMonitoringInfo - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tenant_pod.go b/models/tenant_pod.go deleted file mode 100644 index 05b6ea3c1..000000000 --- a/models/tenant_pod.go +++ /dev/null @@ -1,103 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// TenantPod tenant pod -// -// swagger:model tenantPod -type TenantPod struct { - - // name - // Required: true - Name *string `json:"name"` - - // node - Node string `json:"node,omitempty"` - - // pod IP - PodIP string `json:"podIP,omitempty"` - - // restarts - Restarts int64 `json:"restarts,omitempty"` - - // status - Status string `json:"status,omitempty"` - - // time created - TimeCreated int64 `json:"timeCreated,omitempty"` -} - -// Validate validates this tenant pod -func (m *TenantPod) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateName(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TenantPod) validateName(formats strfmt.Registry) error { - - if err := validate.Required("name", "body", m.Name); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this tenant pod based on context it is used -func (m *TenantPod) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *TenantPod) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TenantPod) UnmarshalBinary(b []byte) error { - var res TenantPod - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tenant_response_item.go b/models/tenant_response_item.go deleted file mode 100644 index 6b94bfd0d..000000000 --- a/models/tenant_response_item.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TenantResponseItem tenant response item -// -// swagger:model tenantResponseItem -type TenantResponseItem struct { - - // access key - AccessKey string `json:"access_key,omitempty"` - - // secret key - SecretKey string `json:"secret_key,omitempty"` - - // url - URL string `json:"url,omitempty"` -} - -// Validate validates this tenant response item -func (m *TenantResponseItem) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this tenant response item based on context it is used -func (m *TenantResponseItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *TenantResponseItem) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TenantResponseItem) UnmarshalBinary(b []byte) error { - var res TenantResponseItem - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tenant_security_response.go b/models/tenant_security_response.go deleted file mode 100644 index d358e06bb..000000000 --- a/models/tenant_security_response.go +++ /dev/null @@ -1,386 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TenantSecurityResponse tenant security response -// -// swagger:model tenantSecurityResponse -type TenantSecurityResponse struct { - - // auto cert - AutoCert bool `json:"autoCert,omitempty"` - - // custom certificates - CustomCertificates *TenantSecurityResponseCustomCertificates `json:"customCertificates,omitempty"` - - // security context - SecurityContext *SecurityContext `json:"securityContext,omitempty"` -} - -// Validate validates this tenant security response -func (m *TenantSecurityResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateCustomCertificates(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSecurityContext(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TenantSecurityResponse) validateCustomCertificates(formats strfmt.Registry) error { - if swag.IsZero(m.CustomCertificates) { // not required - return nil - } - - if m.CustomCertificates != nil { - if err := m.CustomCertificates.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("customCertificates") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("customCertificates") - } - return err - } - } - - return nil -} - -func (m *TenantSecurityResponse) validateSecurityContext(formats strfmt.Registry) error { - if swag.IsZero(m.SecurityContext) { // not required - return nil - } - - if m.SecurityContext != nil { - if err := m.SecurityContext.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("securityContext") - } - return err - } - } - - return nil -} - -// ContextValidate validate this tenant security response based on the context it is used -func (m *TenantSecurityResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateCustomCertificates(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateSecurityContext(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TenantSecurityResponse) contextValidateCustomCertificates(ctx context.Context, formats strfmt.Registry) error { - - if m.CustomCertificates != nil { - if err := m.CustomCertificates.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("customCertificates") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("customCertificates") - } - return err - } - } - - return nil -} - -func (m *TenantSecurityResponse) contextValidateSecurityContext(ctx context.Context, formats strfmt.Registry) error { - - if m.SecurityContext != nil { - if err := m.SecurityContext.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("securityContext") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *TenantSecurityResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TenantSecurityResponse) UnmarshalBinary(b []byte) error { - var res TenantSecurityResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// TenantSecurityResponseCustomCertificates tenant security response custom certificates -// -// swagger:model TenantSecurityResponseCustomCertificates -type TenantSecurityResponseCustomCertificates struct { - - // client - Client []*CertificateInfo `json:"client"` - - // minio - Minio []*CertificateInfo `json:"minio"` - - // minio c as - MinioCAs []*CertificateInfo `json:"minioCAs"` -} - -// Validate validates this tenant security response custom certificates -func (m *TenantSecurityResponseCustomCertificates) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateClient(formats); err != nil { - res = append(res, err) - } - - if err := m.validateMinio(formats); err != nil { - res = append(res, err) - } - - if err := m.validateMinioCAs(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TenantSecurityResponseCustomCertificates) validateClient(formats strfmt.Registry) error { - if swag.IsZero(m.Client) { // not required - return nil - } - - for i := 0; i < len(m.Client); i++ { - if swag.IsZero(m.Client[i]) { // not required - continue - } - - if m.Client[i] != nil { - if err := m.Client[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("customCertificates" + "." + "client" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("customCertificates" + "." + "client" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantSecurityResponseCustomCertificates) validateMinio(formats strfmt.Registry) error { - if swag.IsZero(m.Minio) { // not required - return nil - } - - for i := 0; i < len(m.Minio); i++ { - if swag.IsZero(m.Minio[i]) { // not required - continue - } - - if m.Minio[i] != nil { - if err := m.Minio[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("customCertificates" + "." + "minio" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("customCertificates" + "." + "minio" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantSecurityResponseCustomCertificates) validateMinioCAs(formats strfmt.Registry) error { - if swag.IsZero(m.MinioCAs) { // not required - return nil - } - - for i := 0; i < len(m.MinioCAs); i++ { - if swag.IsZero(m.MinioCAs[i]) { // not required - continue - } - - if m.MinioCAs[i] != nil { - if err := m.MinioCAs[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("customCertificates" + "." + "minioCAs" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("customCertificates" + "." + "minioCAs" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this tenant security response custom certificates based on the context it is used -func (m *TenantSecurityResponseCustomCertificates) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateClient(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateMinio(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateMinioCAs(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TenantSecurityResponseCustomCertificates) contextValidateClient(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Client); i++ { - - if m.Client[i] != nil { - if err := m.Client[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("customCertificates" + "." + "client" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("customCertificates" + "." + "client" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantSecurityResponseCustomCertificates) contextValidateMinio(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Minio); i++ { - - if m.Minio[i] != nil { - if err := m.Minio[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("customCertificates" + "." + "minio" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("customCertificates" + "." + "minio" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TenantSecurityResponseCustomCertificates) contextValidateMinioCAs(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.MinioCAs); i++ { - - if m.MinioCAs[i] != nil { - if err := m.MinioCAs[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("customCertificates" + "." + "minioCAs" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("customCertificates" + "." + "minioCAs" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *TenantSecurityResponseCustomCertificates) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TenantSecurityResponseCustomCertificates) UnmarshalBinary(b []byte) error { - var res TenantSecurityResponseCustomCertificates - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tenant_status.go b/models/tenant_status.go deleted file mode 100644 index 8238c6ae1..000000000 --- a/models/tenant_status.go +++ /dev/null @@ -1,182 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TenantStatus tenant status -// -// swagger:model tenantStatus -type TenantStatus struct { - - // drives healing - DrivesHealing int32 `json:"drives_healing,omitempty"` - - // drives offline - DrivesOffline int32 `json:"drives_offline,omitempty"` - - // drives online - DrivesOnline int32 `json:"drives_online,omitempty"` - - // health status - HealthStatus string `json:"health_status,omitempty"` - - // usage - Usage *TenantStatusUsage `json:"usage,omitempty"` - - // write quorum - WriteQuorum int32 `json:"write_quorum,omitempty"` -} - -// Validate validates this tenant status -func (m *TenantStatus) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateUsage(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TenantStatus) validateUsage(formats strfmt.Registry) error { - if swag.IsZero(m.Usage) { // not required - return nil - } - - if m.Usage != nil { - if err := m.Usage.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("usage") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("usage") - } - return err - } - } - - return nil -} - -// ContextValidate validate this tenant status based on the context it is used -func (m *TenantStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateUsage(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TenantStatus) contextValidateUsage(ctx context.Context, formats strfmt.Registry) error { - - if m.Usage != nil { - if err := m.Usage.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("usage") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("usage") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *TenantStatus) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TenantStatus) UnmarshalBinary(b []byte) error { - var res TenantStatus - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// TenantStatusUsage tenant status usage -// -// swagger:model TenantStatusUsage -type TenantStatusUsage struct { - - // capacity - Capacity int64 `json:"capacity,omitempty"` - - // capacity usage - CapacityUsage int64 `json:"capacity_usage,omitempty"` - - // raw - Raw int64 `json:"raw,omitempty"` - - // raw usage - RawUsage int64 `json:"raw_usage,omitempty"` -} - -// Validate validates this tenant status usage -func (m *TenantStatusUsage) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this tenant status usage based on context it is used -func (m *TenantStatusUsage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *TenantStatusUsage) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TenantStatusUsage) UnmarshalBinary(b []byte) error { - var res TenantStatusUsage - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tenant_tier_element.go b/models/tenant_tier_element.go deleted file mode 100644 index 5aadcc3ad..000000000 --- a/models/tenant_tier_element.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TenantTierElement tenant tier element -// -// swagger:model tenantTierElement -type TenantTierElement struct { - - // name - Name string `json:"name,omitempty"` - - // size - Size int64 `json:"size,omitempty"` - - // type - Type string `json:"type,omitempty"` -} - -// Validate validates this tenant tier element -func (m *TenantTierElement) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this tenant tier element based on context it is used -func (m *TenantTierElement) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *TenantTierElement) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TenantTierElement) UnmarshalBinary(b []byte) error { - var res TenantTierElement - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tenant_usage.go b/models/tenant_usage.go deleted file mode 100644 index b96cb79b6..000000000 --- a/models/tenant_usage.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TenantUsage tenant usage -// -// swagger:model tenantUsage -type TenantUsage struct { - - // disk used - DiskUsed int64 `json:"disk_used,omitempty"` - - // used - Used int64 `json:"used,omitempty"` -} - -// Validate validates this tenant usage -func (m *TenantUsage) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this tenant usage based on context it is used -func (m *TenantUsage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *TenantUsage) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TenantUsage) UnmarshalBinary(b []byte) error { - var res TenantUsage - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tenant_y_a_m_l.go b/models/tenant_y_a_m_l.go deleted file mode 100644 index 0096af109..000000000 --- a/models/tenant_y_a_m_l.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TenantYAML tenant y a m l -// -// swagger:model tenantYAML -type TenantYAML struct { - - // yaml - Yaml string `json:"yaml,omitempty"` -} - -// Validate validates this tenant y a m l -func (m *TenantYAML) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this tenant y a m l based on context it is used -func (m *TenantYAML) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *TenantYAML) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TenantYAML) UnmarshalBinary(b []byte) error { - var res TenantYAML - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tls_configuration.go b/models/tls_configuration.go deleted file mode 100644 index 1c4febd72..000000000 --- a/models/tls_configuration.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TLSConfiguration tls configuration -// -// swagger:model tlsConfiguration -type TLSConfiguration struct { - - // minio c as certificates - MinioCAsCertificates []string `json:"minioCAsCertificates"` - - // minio client certificates - MinioClientCertificates []*KeyPairConfiguration `json:"minioClientCertificates"` - - // minio server certificates - MinioServerCertificates []*KeyPairConfiguration `json:"minioServerCertificates"` -} - -// Validate validates this tls configuration -func (m *TLSConfiguration) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateMinioClientCertificates(formats); err != nil { - res = append(res, err) - } - - if err := m.validateMinioServerCertificates(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TLSConfiguration) validateMinioClientCertificates(formats strfmt.Registry) error { - if swag.IsZero(m.MinioClientCertificates) { // not required - return nil - } - - for i := 0; i < len(m.MinioClientCertificates); i++ { - if swag.IsZero(m.MinioClientCertificates[i]) { // not required - continue - } - - if m.MinioClientCertificates[i] != nil { - if err := m.MinioClientCertificates[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("minioClientCertificates" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("minioClientCertificates" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TLSConfiguration) validateMinioServerCertificates(formats strfmt.Registry) error { - if swag.IsZero(m.MinioServerCertificates) { // not required - return nil - } - - for i := 0; i < len(m.MinioServerCertificates); i++ { - if swag.IsZero(m.MinioServerCertificates[i]) { // not required - continue - } - - if m.MinioServerCertificates[i] != nil { - if err := m.MinioServerCertificates[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("minioServerCertificates" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("minioServerCertificates" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this tls configuration based on the context it is used -func (m *TLSConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateMinioClientCertificates(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateMinioServerCertificates(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TLSConfiguration) contextValidateMinioClientCertificates(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.MinioClientCertificates); i++ { - - if m.MinioClientCertificates[i] != nil { - if err := m.MinioClientCertificates[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("minioClientCertificates" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("minioClientCertificates" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *TLSConfiguration) contextValidateMinioServerCertificates(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.MinioServerCertificates); i++ { - - if m.MinioServerCertificates[i] != nil { - if err := m.MinioServerCertificates[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("minioServerCertificates" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("minioServerCertificates" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *TLSConfiguration) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TLSConfiguration) UnmarshalBinary(b []byte) error { - var res TLSConfiguration - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/toleration.go b/models/toleration.go deleted file mode 100644 index c76890507..000000000 --- a/models/toleration.go +++ /dev/null @@ -1,79 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// Toleration toleration -// -// swagger:model toleration -type Toleration struct { - - // effect - Effect string `json:"effect,omitempty"` - - // key - Key string `json:"key,omitempty"` - - // operator - Operator string `json:"operator,omitempty"` - - // toleration seconds - TolerationSeconds int64 `json:"tolerationSeconds,omitempty"` - - // value - Value string `json:"value,omitempty"` -} - -// Validate validates this toleration -func (m *Toleration) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this toleration based on context it is used -func (m *Toleration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *Toleration) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *Toleration) UnmarshalBinary(b []byte) error { - var res Toleration - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/update_domains_request.go b/models/update_domains_request.go deleted file mode 100644 index 8a206ba52..000000000 --- a/models/update_domains_request.go +++ /dev/null @@ -1,121 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// UpdateDomainsRequest update domains request -// -// swagger:model updateDomainsRequest -type UpdateDomainsRequest struct { - - // domains - Domains *DomainsConfiguration `json:"domains,omitempty"` -} - -// Validate validates this update domains request -func (m *UpdateDomainsRequest) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateDomains(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *UpdateDomainsRequest) validateDomains(formats strfmt.Registry) error { - if swag.IsZero(m.Domains) { // not required - return nil - } - - if m.Domains != nil { - if err := m.Domains.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("domains") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("domains") - } - return err - } - } - - return nil -} - -// ContextValidate validate this update domains request based on the context it is used -func (m *UpdateDomainsRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateDomains(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *UpdateDomainsRequest) contextValidateDomains(ctx context.Context, formats strfmt.Registry) error { - - if m.Domains != nil { - if err := m.Domains.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("domains") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("domains") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *UpdateDomainsRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *UpdateDomainsRequest) UnmarshalBinary(b []byte) error { - var res UpdateDomainsRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/update_tenant_configuration_request.go b/models/update_tenant_configuration_request.go deleted file mode 100644 index 89a8c0bf3..000000000 --- a/models/update_tenant_configuration_request.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// UpdateTenantConfigurationRequest update tenant configuration request -// -// swagger:model updateTenantConfigurationRequest -type UpdateTenantConfigurationRequest struct { - - // environment variables - EnvironmentVariables []*EnvironmentVariable `json:"environmentVariables"` - - // keys to be deleted - KeysToBeDeleted []string `json:"keysToBeDeleted"` -} - -// Validate validates this update tenant configuration request -func (m *UpdateTenantConfigurationRequest) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateEnvironmentVariables(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *UpdateTenantConfigurationRequest) validateEnvironmentVariables(formats strfmt.Registry) error { - if swag.IsZero(m.EnvironmentVariables) { // not required - return nil - } - - for i := 0; i < len(m.EnvironmentVariables); i++ { - if swag.IsZero(m.EnvironmentVariables[i]) { // not required - continue - } - - if m.EnvironmentVariables[i] != nil { - if err := m.EnvironmentVariables[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("environmentVariables" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("environmentVariables" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this update tenant configuration request based on the context it is used -func (m *UpdateTenantConfigurationRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateEnvironmentVariables(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *UpdateTenantConfigurationRequest) contextValidateEnvironmentVariables(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.EnvironmentVariables); i++ { - - if m.EnvironmentVariables[i] != nil { - if err := m.EnvironmentVariables[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("environmentVariables" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("environmentVariables" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *UpdateTenantConfigurationRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *UpdateTenantConfigurationRequest) UnmarshalBinary(b []byte) error { - var res UpdateTenantConfigurationRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/update_tenant_request.go b/models/update_tenant_request.go deleted file mode 100644 index 8cf155982..000000000 --- a/models/update_tenant_request.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// UpdateTenantRequest update tenant request -// -// swagger:model updateTenantRequest -type UpdateTenantRequest struct { - - // enable prometheus - EnablePrometheus bool `json:"enable_prometheus,omitempty"` - - // image - // Pattern: ^((.*?)/(.*?):(.+))$ - Image string `json:"image,omitempty"` - - // image pull secret - ImagePullSecret string `json:"image_pull_secret,omitempty"` - - // image registry - ImageRegistry *ImageRegistry `json:"image_registry,omitempty"` -} - -// Validate validates this update tenant request -func (m *UpdateTenantRequest) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateImage(formats); err != nil { - res = append(res, err) - } - - if err := m.validateImageRegistry(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *UpdateTenantRequest) validateImage(formats strfmt.Registry) error { - if swag.IsZero(m.Image) { // not required - return nil - } - - if err := validate.Pattern("image", "body", m.Image, `^((.*?)/(.*?):(.+))$`); err != nil { - return err - } - - return nil -} - -func (m *UpdateTenantRequest) validateImageRegistry(formats strfmt.Registry) error { - if swag.IsZero(m.ImageRegistry) { // not required - return nil - } - - if m.ImageRegistry != nil { - if err := m.ImageRegistry.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("image_registry") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("image_registry") - } - return err - } - } - - return nil -} - -// ContextValidate validate this update tenant request based on the context it is used -func (m *UpdateTenantRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateImageRegistry(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *UpdateTenantRequest) contextValidateImageRegistry(ctx context.Context, formats strfmt.Registry) error { - - if m.ImageRegistry != nil { - if err := m.ImageRegistry.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("image_registry") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("image_registry") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *UpdateTenantRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *UpdateTenantRequest) UnmarshalBinary(b []byte) error { - var res UpdateTenantRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/update_tenant_security_request.go b/models/update_tenant_security_request.go deleted file mode 100644 index e6001cd40..000000000 --- a/models/update_tenant_security_request.go +++ /dev/null @@ -1,335 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// UpdateTenantSecurityRequest update tenant security request -// -// swagger:model updateTenantSecurityRequest -type UpdateTenantSecurityRequest struct { - - // auto cert - AutoCert bool `json:"autoCert,omitempty"` - - // custom certificates - CustomCertificates *UpdateTenantSecurityRequestCustomCertificates `json:"customCertificates,omitempty"` - - // security context - SecurityContext *SecurityContext `json:"securityContext,omitempty"` -} - -// Validate validates this update tenant security request -func (m *UpdateTenantSecurityRequest) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateCustomCertificates(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSecurityContext(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *UpdateTenantSecurityRequest) validateCustomCertificates(formats strfmt.Registry) error { - if swag.IsZero(m.CustomCertificates) { // not required - return nil - } - - if m.CustomCertificates != nil { - if err := m.CustomCertificates.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("customCertificates") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("customCertificates") - } - return err - } - } - - return nil -} - -func (m *UpdateTenantSecurityRequest) validateSecurityContext(formats strfmt.Registry) error { - if swag.IsZero(m.SecurityContext) { // not required - return nil - } - - if m.SecurityContext != nil { - if err := m.SecurityContext.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("securityContext") - } - return err - } - } - - return nil -} - -// ContextValidate validate this update tenant security request based on the context it is used -func (m *UpdateTenantSecurityRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateCustomCertificates(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateSecurityContext(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *UpdateTenantSecurityRequest) contextValidateCustomCertificates(ctx context.Context, formats strfmt.Registry) error { - - if m.CustomCertificates != nil { - if err := m.CustomCertificates.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("customCertificates") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("customCertificates") - } - return err - } - } - - return nil -} - -func (m *UpdateTenantSecurityRequest) contextValidateSecurityContext(ctx context.Context, formats strfmt.Registry) error { - - if m.SecurityContext != nil { - if err := m.SecurityContext.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("securityContext") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("securityContext") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *UpdateTenantSecurityRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *UpdateTenantSecurityRequest) UnmarshalBinary(b []byte) error { - var res UpdateTenantSecurityRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// UpdateTenantSecurityRequestCustomCertificates update tenant security request custom certificates -// -// swagger:model UpdateTenantSecurityRequestCustomCertificates -type UpdateTenantSecurityRequestCustomCertificates struct { - - // minio c as certificates - MinioCAsCertificates []string `json:"minioCAsCertificates"` - - // minio client certificates - MinioClientCertificates []*KeyPairConfiguration `json:"minioClientCertificates"` - - // minio server certificates - MinioServerCertificates []*KeyPairConfiguration `json:"minioServerCertificates"` - - // secrets to be deleted - SecretsToBeDeleted []string `json:"secretsToBeDeleted"` -} - -// Validate validates this update tenant security request custom certificates -func (m *UpdateTenantSecurityRequestCustomCertificates) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateMinioClientCertificates(formats); err != nil { - res = append(res, err) - } - - if err := m.validateMinioServerCertificates(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *UpdateTenantSecurityRequestCustomCertificates) validateMinioClientCertificates(formats strfmt.Registry) error { - if swag.IsZero(m.MinioClientCertificates) { // not required - return nil - } - - for i := 0; i < len(m.MinioClientCertificates); i++ { - if swag.IsZero(m.MinioClientCertificates[i]) { // not required - continue - } - - if m.MinioClientCertificates[i] != nil { - if err := m.MinioClientCertificates[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("customCertificates" + "." + "minioClientCertificates" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("customCertificates" + "." + "minioClientCertificates" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *UpdateTenantSecurityRequestCustomCertificates) validateMinioServerCertificates(formats strfmt.Registry) error { - if swag.IsZero(m.MinioServerCertificates) { // not required - return nil - } - - for i := 0; i < len(m.MinioServerCertificates); i++ { - if swag.IsZero(m.MinioServerCertificates[i]) { // not required - continue - } - - if m.MinioServerCertificates[i] != nil { - if err := m.MinioServerCertificates[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("customCertificates" + "." + "minioServerCertificates" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("customCertificates" + "." + "minioServerCertificates" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this update tenant security request custom certificates based on the context it is used -func (m *UpdateTenantSecurityRequestCustomCertificates) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateMinioClientCertificates(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateMinioServerCertificates(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *UpdateTenantSecurityRequestCustomCertificates) contextValidateMinioClientCertificates(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.MinioClientCertificates); i++ { - - if m.MinioClientCertificates[i] != nil { - if err := m.MinioClientCertificates[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("customCertificates" + "." + "minioClientCertificates" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("customCertificates" + "." + "minioClientCertificates" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *UpdateTenantSecurityRequestCustomCertificates) contextValidateMinioServerCertificates(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.MinioServerCertificates); i++ { - - if m.MinioServerCertificates[i] != nil { - if err := m.MinioServerCertificates[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("customCertificates" + "." + "minioServerCertificates" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("customCertificates" + "." + "minioServerCertificates" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *UpdateTenantSecurityRequestCustomCertificates) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *UpdateTenantSecurityRequestCustomCertificates) UnmarshalBinary(b []byte) error { - var res UpdateTenantSecurityRequestCustomCertificates - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/vault_configuration.go b/models/vault_configuration.go deleted file mode 100644 index b8b48ff9b..000000000 --- a/models/vault_configuration.go +++ /dev/null @@ -1,312 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// VaultConfiguration vault configuration -// -// swagger:model vaultConfiguration -type VaultConfiguration struct { - - // approle - // Required: true - Approle *VaultConfigurationApprole `json:"approle"` - - // endpoint - // Required: true - Endpoint *string `json:"endpoint"` - - // engine - Engine string `json:"engine,omitempty"` - - // namespace - Namespace string `json:"namespace,omitempty"` - - // prefix - Prefix string `json:"prefix,omitempty"` - - // status - Status *VaultConfigurationStatus `json:"status,omitempty"` -} - -// Validate validates this vault configuration -func (m *VaultConfiguration) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateApprole(formats); err != nil { - res = append(res, err) - } - - if err := m.validateEndpoint(formats); err != nil { - res = append(res, err) - } - - if err := m.validateStatus(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *VaultConfiguration) validateApprole(formats strfmt.Registry) error { - - if err := validate.Required("approle", "body", m.Approle); err != nil { - return err - } - - if m.Approle != nil { - if err := m.Approle.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("approle") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("approle") - } - return err - } - } - - return nil -} - -func (m *VaultConfiguration) validateEndpoint(formats strfmt.Registry) error { - - if err := validate.Required("endpoint", "body", m.Endpoint); err != nil { - return err - } - - return nil -} - -func (m *VaultConfiguration) validateStatus(formats strfmt.Registry) error { - if swag.IsZero(m.Status) { // not required - return nil - } - - if m.Status != nil { - if err := m.Status.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("status") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("status") - } - return err - } - } - - return nil -} - -// ContextValidate validate this vault configuration based on the context it is used -func (m *VaultConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateApprole(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateStatus(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *VaultConfiguration) contextValidateApprole(ctx context.Context, formats strfmt.Registry) error { - - if m.Approle != nil { - if err := m.Approle.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("approle") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("approle") - } - return err - } - } - - return nil -} - -func (m *VaultConfiguration) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { - - if m.Status != nil { - if err := m.Status.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("status") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("status") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *VaultConfiguration) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *VaultConfiguration) UnmarshalBinary(b []byte) error { - var res VaultConfiguration - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// VaultConfigurationApprole vault configuration approle -// -// swagger:model VaultConfigurationApprole -type VaultConfigurationApprole struct { - - // engine - Engine string `json:"engine,omitempty"` - - // id - // Required: true - ID *string `json:"id"` - - // retry - Retry int64 `json:"retry,omitempty"` - - // secret - // Required: true - Secret *string `json:"secret"` -} - -// Validate validates this vault configuration approle -func (m *VaultConfigurationApprole) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateID(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSecret(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *VaultConfigurationApprole) validateID(formats strfmt.Registry) error { - - if err := validate.Required("approle"+"."+"id", "body", m.ID); err != nil { - return err - } - - return nil -} - -func (m *VaultConfigurationApprole) validateSecret(formats strfmt.Registry) error { - - if err := validate.Required("approle"+"."+"secret", "body", m.Secret); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this vault configuration approle based on context it is used -func (m *VaultConfigurationApprole) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *VaultConfigurationApprole) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *VaultConfigurationApprole) UnmarshalBinary(b []byte) error { - var res VaultConfigurationApprole - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// VaultConfigurationStatus vault configuration status -// -// swagger:model VaultConfigurationStatus -type VaultConfigurationStatus struct { - - // ping - Ping int64 `json:"ping,omitempty"` -} - -// Validate validates this vault configuration status -func (m *VaultConfigurationStatus) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this vault configuration status based on context it is used -func (m *VaultConfigurationStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *VaultConfigurationStatus) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *VaultConfigurationStatus) UnmarshalBinary(b []byte) error { - var res VaultConfigurationStatus - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/vault_configuration_response.go b/models/vault_configuration_response.go deleted file mode 100644 index 19bbf65eb..000000000 --- a/models/vault_configuration_response.go +++ /dev/null @@ -1,312 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// VaultConfigurationResponse vault configuration response -// -// swagger:model vaultConfigurationResponse -type VaultConfigurationResponse struct { - - // approle - // Required: true - Approle *VaultConfigurationResponseApprole `json:"approle"` - - // endpoint - // Required: true - Endpoint *string `json:"endpoint"` - - // engine - Engine string `json:"engine,omitempty"` - - // namespace - Namespace string `json:"namespace,omitempty"` - - // prefix - Prefix string `json:"prefix,omitempty"` - - // status - Status *VaultConfigurationResponseStatus `json:"status,omitempty"` -} - -// Validate validates this vault configuration response -func (m *VaultConfigurationResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateApprole(formats); err != nil { - res = append(res, err) - } - - if err := m.validateEndpoint(formats); err != nil { - res = append(res, err) - } - - if err := m.validateStatus(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *VaultConfigurationResponse) validateApprole(formats strfmt.Registry) error { - - if err := validate.Required("approle", "body", m.Approle); err != nil { - return err - } - - if m.Approle != nil { - if err := m.Approle.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("approle") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("approle") - } - return err - } - } - - return nil -} - -func (m *VaultConfigurationResponse) validateEndpoint(formats strfmt.Registry) error { - - if err := validate.Required("endpoint", "body", m.Endpoint); err != nil { - return err - } - - return nil -} - -func (m *VaultConfigurationResponse) validateStatus(formats strfmt.Registry) error { - if swag.IsZero(m.Status) { // not required - return nil - } - - if m.Status != nil { - if err := m.Status.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("status") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("status") - } - return err - } - } - - return nil -} - -// ContextValidate validate this vault configuration response based on the context it is used -func (m *VaultConfigurationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateApprole(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateStatus(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *VaultConfigurationResponse) contextValidateApprole(ctx context.Context, formats strfmt.Registry) error { - - if m.Approle != nil { - if err := m.Approle.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("approle") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("approle") - } - return err - } - } - - return nil -} - -func (m *VaultConfigurationResponse) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { - - if m.Status != nil { - if err := m.Status.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("status") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("status") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *VaultConfigurationResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *VaultConfigurationResponse) UnmarshalBinary(b []byte) error { - var res VaultConfigurationResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// VaultConfigurationResponseApprole vault configuration response approle -// -// swagger:model VaultConfigurationResponseApprole -type VaultConfigurationResponseApprole struct { - - // engine - Engine string `json:"engine,omitempty"` - - // id - // Required: true - ID *string `json:"id"` - - // retry - Retry int64 `json:"retry,omitempty"` - - // secret - // Required: true - Secret *string `json:"secret"` -} - -// Validate validates this vault configuration response approle -func (m *VaultConfigurationResponseApprole) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateID(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSecret(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *VaultConfigurationResponseApprole) validateID(formats strfmt.Registry) error { - - if err := validate.Required("approle"+"."+"id", "body", m.ID); err != nil { - return err - } - - return nil -} - -func (m *VaultConfigurationResponseApprole) validateSecret(formats strfmt.Registry) error { - - if err := validate.Required("approle"+"."+"secret", "body", m.Secret); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this vault configuration response approle based on context it is used -func (m *VaultConfigurationResponseApprole) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *VaultConfigurationResponseApprole) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *VaultConfigurationResponseApprole) UnmarshalBinary(b []byte) error { - var res VaultConfigurationResponseApprole - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// VaultConfigurationResponseStatus vault configuration response status -// -// swagger:model VaultConfigurationResponseStatus -type VaultConfigurationResponseStatus struct { - - // ping - Ping int64 `json:"ping,omitempty"` -} - -// Validate validates this vault configuration response status -func (m *VaultConfigurationResponseStatus) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this vault configuration response status based on context it is used -func (m *VaultConfigurationResponseStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *VaultConfigurationResponseStatus) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *VaultConfigurationResponseStatus) UnmarshalBinary(b []byte) error { - var res VaultConfigurationResponseStatus - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/volume.go b/models/volume.go deleted file mode 100644 index 98dcd2477..000000000 --- a/models/volume.go +++ /dev/null @@ -1,170 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// Volume volume -// -// swagger:model volume -type Volume struct { - - // name - Name string `json:"name,omitempty"` - - // projected - Projected *ProjectedVolume `json:"projected,omitempty"` - - // pvc - Pvc *Pvc `json:"pvc,omitempty"` -} - -// Validate validates this volume -func (m *Volume) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateProjected(formats); err != nil { - res = append(res, err) - } - - if err := m.validatePvc(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Volume) validateProjected(formats strfmt.Registry) error { - if swag.IsZero(m.Projected) { // not required - return nil - } - - if m.Projected != nil { - if err := m.Projected.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("projected") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("projected") - } - return err - } - } - - return nil -} - -func (m *Volume) validatePvc(formats strfmt.Registry) error { - if swag.IsZero(m.Pvc) { // not required - return nil - } - - if m.Pvc != nil { - if err := m.Pvc.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("pvc") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("pvc") - } - return err - } - } - - return nil -} - -// ContextValidate validate this volume based on the context it is used -func (m *Volume) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateProjected(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidatePvc(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Volume) contextValidateProjected(ctx context.Context, formats strfmt.Registry) error { - - if m.Projected != nil { - if err := m.Projected.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("projected") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("projected") - } - return err - } - } - - return nil -} - -func (m *Volume) contextValidatePvc(ctx context.Context, formats strfmt.Registry) error { - - if m.Pvc != nil { - if err := m.Pvc.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("pvc") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("pvc") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *Volume) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *Volume) UnmarshalBinary(b []byte) error { - var res Volume - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/operator-integration/tenant_test.go b/operator-integration/tenant_test.go deleted file mode 100644 index 548020ede..000000000 --- a/operator-integration/tenant_test.go +++ /dev/null @@ -1,1307 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorintegration - -import ( - "bytes" - b64 "encoding/base64" - "encoding/json" - "fmt" - "io" - "io/ioutil" - "log" - "net/http" - "os" - "os/exec" - "strconv" - "strings" - "testing" - "time" - - "github.com/go-openapi/loads" - "github.com/minio/console/models" - "github.com/minio/console/operatorapi" - "github.com/minio/console/operatorapi/operations" - "github.com/stretchr/testify/assert" -) - -var ( - token string - jwt string -) - -func inspectHTTPResponse(httpResponse *http.Response) string { - /* - Helper function to inspect the content of a HTTP response. - */ - b, err := io.ReadAll(httpResponse.Body) - if err != nil { - log.Fatalln(err) - } - return "Http Response: " + string(b) -} - -func decodeBase64(value string) string { - /* - Helper function to decode in base64 - */ - result, err := b64.StdEncoding.DecodeString(value) - if err != nil { - log.Fatal("error:", err) - } - return string(result) -} - -func printLoggingMessage(message string, functionName string) { - /* - Helper function to have standard output across the tests. - */ - finalString := "......................." + functionName + "(): " + message - fmt.Println(finalString) -} - -func printStartFunc(functionName string) { - /* - Common function for all tests to tell that test has started - */ - fmt.Println("") - printLoggingMessage("started", functionName) -} - -func printEndFunc(functionName string) { - /* - Helper function for all tests to tell that test has ended, is completed - */ - printLoggingMessage("completed", functionName) - fmt.Println("") -} - -func initConsoleServer() (*operatorapi.Server, error) { - // os.Setenv("CONSOLE_MINIO_SERVER", "localhost:9000") - - swaggerSpec, err := loads.Embedded(operatorapi.SwaggerJSON, operatorapi.FlatSwaggerJSON) - if err != nil { - return nil, err - } - - noLog := func(string, ...interface{}) { - // nothing to log - } - - // Initialize MinIO loggers - operatorapi.LogInfo = noLog - operatorapi.LogError = noLog - - api := operations.NewOperatorAPI(swaggerSpec) - api.Logger = noLog - - server := operatorapi.NewServer(api) - // register all APIs - server.ConfigureAPI() - - consolePort, _ := strconv.Atoi("9090") - - server.Host = "0.0.0.0" - server.Port = consolePort - operatorapi.Port = "9090" - operatorapi.Hostname = "0.0.0.0" - - return server, nil -} - -func TestMain(m *testing.M) { - printStartFunc("TestMain") - // start console server - go func() { - fmt.Println("start server") - srv, err := initConsoleServer() - fmt.Println("Server has been started at this point") - if err != nil { - fmt.Println("There is an error in console server: ", err) - log.Println(err) - log.Println("init fail") - return - } - fmt.Println("Start serving with Serve() function") - srv.Serve() - fmt.Println("After Serve() function") - }() - - fmt.Println("sleeping") - time.Sleep(2 * time.Second) - fmt.Println("after 2 seconds sleep") - - fmt.Println("creating the client") - - // SA_TOKEN=$(kubectl -n minio-operator get secret console-sa-secret -o jsonpath="{.data.token}" | base64 --decode) - fmt.Println("Where we have the secret already: ") - app2 := "kubectl" - argu0 := "--namespace" - argu1 := "minio-operator" - argu2 := "get" - argu3 := "secret" - argu4 := "console-sa-secret" - argu5 := "-o" - argu6 := "jsonpath=\"{.data.token}\"" - fmt.Println("Prior executing second command to get the token") - cmd2 := exec.Command(app2, argu0, argu1, argu2, argu3, argu4, argu5, argu6) - fmt.Println("after executing second command to get the token") - var out2 bytes.Buffer - var stderr2 bytes.Buffer - cmd2.Stdout = &out2 - cmd2.Stderr = &stderr2 - err2 := cmd2.Run() - if err2 != nil { - fmt.Println(fmt.Sprint(err2) + ": -> " + stderr2.String()) - return - } - secret2 := out2.String() - jwt := decodeBase64(secret2[1 : len(secret2)-1]) - if jwt == "" { - fmt.Println("jwt cannot be empty string") - os.Exit(-1) - } - response, err := LoginOperator() - if err != nil { - log.Println(err) - return - } - - if response != nil { - for _, cookie := range response.Cookies() { - if cookie.Name == "token" { - token = cookie.Value - break - } - } - } - - if token == "" { - log.Println("authentication token not found in cookies response") - return - } - - code := m.Run() - printEndFunc("TestMain") - os.Exit(code) -} - -func ListTenants() (*http.Response, error) { - /* - Helper function to list buckets - HTTP Verb: GET - URL: http://localhost:9090/api/v1/tenants - */ - request, err := http.NewRequest( - "GET", "http://localhost:9090/api/v1/tenants", nil) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestListTenants(t *testing.T) { - // Tenants can be listed via API: https://github.com/miniohq/engineering/issues/591 - printStartFunc("TestListTenants") - assert := assert.New(t) - resp, err := ListTenants() - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 200, resp.StatusCode, "Status Code is incorrect") - } - bodyBytes, _ := ioutil.ReadAll(resp.Body) - result := models.ListTenantsResponse{} - err = json.Unmarshal(bodyBytes, &result) - if err != nil { - log.Println(err) - assert.Nil(err) - } - TenantName := &result.Tenants[0].Name // The array has to be empty, no index accessible - fmt.Println(*TenantName) - assert.Equal("storage-kms-encrypted", *TenantName, *TenantName) - printEndFunc("TestListTenants") -} - -func CreateTenant(tenantName string, namespace string, accessKey string, secretKey string, accessKeys []string, idp map[string]interface{}, tls map[string]interface{}, prometheusConfiguration map[string]interface{}, logSearchConfiguration map[string]interface{}, erasureCodingParity int, pools []map[string]interface{}, exposeConsole bool, exposeMinIO bool, image string, serviceName string, enablePrometheus bool, enableConsole bool, enableTLS bool, secretKeys []string) (*http.Response, error) { - /* - Helper function to create a tenant - HTTP Verb: POST - API: /api/v1/tenants - */ - requestDataAdd := map[string]interface{}{ - "name": tenantName, - "namespace": namespace, - "access_key": accessKey, - "secret_key": secretKey, - "access_keys": accessKeys, - "secret_keys": secretKeys, - "enable_tls": enableTLS, - "enable_console": enableConsole, - "enable_prometheus": enablePrometheus, - "service_name": serviceName, - "image": image, - "expose_minio": exposeMinIO, - "expose_console": exposeConsole, - "pools": pools, - "erasureCodingParity": erasureCodingParity, - "logSearchConfiguration": logSearchConfiguration, - "prometheusConfiguration": prometheusConfiguration, - "tls": tls, - "idp": idp, - } - requestDataJSON, _ := json.Marshal(requestDataAdd) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "POST", - "http://localhost:9090/api/v1/tenants", - requestDataBody, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func DeleteTenant(nameSpace, tenant string) (*http.Response, error) { - /* - URL: /namespaces/{namespace}/tenants/{tenant}: - HTTP Verb: DELETE - Summary: Delete tenant and underlying pvcs - */ - request, err := http.NewRequest( - "DELETE", - "http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant, - nil, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestCreateTenant(t *testing.T) { - printStartFunc("TestCreateTenant") - - // Variables - assert := assert.New(t) - erasureCodingParity := 2 - tenantName := "new-tenant" - namespace := "default" - accessKey := "" - secretKey := "" - var accessKeys []string - var secretKeys []string - var minio []string - var caCertificates []string - var consoleCAcertificates []string - enableTLS := true - enableConsole := true - enablePrometheus := true - serviceName := "" - image := "" - exposeMinIO := true - exposeConsole := true - values := make([]string, 1) - values[0] = "new-tenant" - values2 := make([]string, 1) - values2[0] = "pool-0" - keys := make([]map[string]interface{}, 1) - keys[0] = map[string]interface{}{ - "access_key": "IGLksSXdiU3fjcRI", - "secret_key": "EqeCPZ1xBYdnygizxxRWnkH09N2350nO", - } - pools := make([]map[string]interface{}, 1) - matchExpressions := make([]map[string]interface{}, 2) - matchExpressions[0] = map[string]interface{}{ - "key": "v1.min.io/tenant", - "operator": "In", - "values": values, - } - matchExpressions[1] = map[string]interface{}{ - "key": "v1.min.io/pool", - "operator": "In", - "values": values2, - } - requiredDuringSchedulingIgnoredDuringExecution := make([]map[string]interface{}, 1) - requiredDuringSchedulingIgnoredDuringExecution[0] = map[string]interface{}{ - "labelSelector": map[string]interface{}{ - "matchExpressions": matchExpressions, - }, - "topologyKey": "kubernetes.io/hostname", - } - pools0 := map[string]interface{}{ - "name": "pool-0", - "servers": 4, - "volumes_per_server": 1, - "volume_configuration": map[string]interface{}{ - "size": 26843545600, - "storage_class_name": "standard", - }, - "securityContext": nil, - "affinity": map[string]interface{}{ - "podAntiAffinity": map[string]interface{}{ - "requiredDuringSchedulingIgnoredDuringExecution": requiredDuringSchedulingIgnoredDuringExecution, - }, - }, - "resources": map[string]interface{}{ - "requests": map[string]interface{}{ - "cpu": 2, - "memory": 2, - }, - }, - } - logSearchConfiguration := map[string]interface{}{ - "image": "", - "postgres_image": "", - "postgres_init_image": "", - } - prometheusConfiguration := map[string]interface{}{ - "image": "", - "sidecar_image": "", - "init_image": "", - } - tls := map[string]interface{}{ - "minio": minio, - "ca_certificates": caCertificates, - "console_ca_certificates": consoleCAcertificates, - } - idp := map[string]interface{}{ - "keys": keys, - } - pools[0] = pools0 - - // 1. Create Tenant - resp, err := CreateTenant( - tenantName, - namespace, - accessKey, - secretKey, - accessKeys, - idp, - tls, - prometheusConfiguration, - logSearchConfiguration, - erasureCodingParity, - pools, - exposeConsole, - exposeMinIO, - image, - serviceName, - enablePrometheus, - enableConsole, - enableTLS, - secretKeys, - ) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 200, resp.StatusCode, "Status Code is incorrect") - } - - printEndFunc("TestCreateTenant") -} - -func TestDeleteTenant(t *testing.T) { - printStartFunc("TestCreateTenant") - - // Variables - assert := assert.New(t) - erasureCodingParity := 2 - tenantName := "new-tenant-3" - namespace := "new-namespace-3" - - // 0. Create the namespace - resp, err := CreateNamespace(namespace) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 201, resp.StatusCode, inspectHTTPResponse(resp)) - } - - accessKey := "" - secretKey := "" - var accessKeys []string - var secretKeys []string - var minio []string - var caCertificates []string - var consoleCAcertificates []string - enableTLS := true - enableConsole := true - enablePrometheus := true - serviceName := "" - image := "" - exposeMinIO := true - exposeConsole := true - values := make([]string, 1) - values[0] = "new-tenant" - values2 := make([]string, 1) - values2[0] = "pool-0" - keys := make([]map[string]interface{}, 1) - keys[0] = map[string]interface{}{ - "access_key": "IGLksSXdiU3fjcRI", - "secret_key": "EqeCPZ1xBYdnygizxxRWnkH09N2350nO", - } - pools := make([]map[string]interface{}, 1) - matchExpressions := make([]map[string]interface{}, 2) - matchExpressions[0] = map[string]interface{}{ - "key": "v1.min.io/tenant", - "operator": "In", - "values": values, - } - matchExpressions[1] = map[string]interface{}{ - "key": "v1.min.io/pool", - "operator": "In", - "values": values2, - } - requiredDuringSchedulingIgnoredDuringExecution := make([]map[string]interface{}, 1) - requiredDuringSchedulingIgnoredDuringExecution[0] = map[string]interface{}{ - "labelSelector": map[string]interface{}{ - "matchExpressions": matchExpressions, - }, - "topologyKey": "kubernetes.io/hostname", - } - pools0 := map[string]interface{}{ - "name": "pool-0", - "servers": 4, - "volumes_per_server": 1, - "volume_configuration": map[string]interface{}{ - "size": 26843545600, - "storage_class_name": "standard", - }, - "securityContext": nil, - "affinity": map[string]interface{}{ - "podAntiAffinity": map[string]interface{}{ - "requiredDuringSchedulingIgnoredDuringExecution": requiredDuringSchedulingIgnoredDuringExecution, - }, - }, - "resources": map[string]interface{}{ - "requests": map[string]interface{}{ - "cpu": 2, - "memory": 2, - }, - }, - } - logSearchConfiguration := map[string]interface{}{ - "image": "", - "postgres_image": "", - "postgres_init_image": "", - } - prometheusConfiguration := map[string]interface{}{ - "image": "", - "sidecar_image": "", - "init_image": "", - } - tls := map[string]interface{}{ - "minio": minio, - "ca_certificates": caCertificates, - "console_ca_certificates": consoleCAcertificates, - } - idp := map[string]interface{}{ - "keys": keys, - } - pools[0] = pools0 - - // 1. Create Tenant - resp, err = CreateTenant( - tenantName, - namespace, - accessKey, - secretKey, - accessKeys, - idp, - tls, - prometheusConfiguration, - logSearchConfiguration, - erasureCodingParity, - pools, - exposeConsole, - exposeMinIO, - image, - serviceName, - enablePrometheus, - enableConsole, - enableTLS, - secretKeys, - ) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 200, resp.StatusCode, "Status Code is incorrect") - } - - // 2. Delete tenant - resp, err = DeleteTenant(namespace, tenantName) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 204, - resp.StatusCode, - inspectHTTPResponse(resp), - ) - } - - printEndFunc("TestCreateTenant") -} - -func ListTenantsByNameSpace(namespace string) (*http.Response, error) { - /* - Helper function to list buckets - HTTP Verb: GET - URL: http://localhost:9090/api/v1/namespaces/{namespace}/tenants - */ - request, err := http.NewRequest( - "GET", "http://localhost:9090/api/v1/namespaces/"+namespace+"/tenants", nil) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestListTenantsByNameSpace(t *testing.T) { - assert := assert.New(t) - namespace := "default" - resp, err := ListTenantsByNameSpace(namespace) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 200, resp.StatusCode, "Status Code is incorrect") - } - bodyBytes, _ := ioutil.ReadAll(resp.Body) - result := models.ListTenantsResponse{} - err = json.Unmarshal(bodyBytes, &result) - if err != nil { - log.Println(err) - assert.Nil(err) - } - if len(result.Tenants) == 0 { - assert.Fail("FAIL: There are no tenants in the array") - } - TenantName := &result.Tenants[0].Name - fmt.Println(*TenantName) - assert.Equal("new-tenant", *TenantName, *TenantName) -} - -func ListNodeLabels() (*http.Response, error) { - /* - Helper function to list buckets - HTTP Verb: GET - URL: http://localhost:9090/api/v1/nodes/labels - */ - request, err := http.NewRequest( - "GET", "http://localhost:9090/api/v1/nodes/labels", nil) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestListNodeLabels(t *testing.T) { - assert := assert.New(t) - resp, err := ListNodeLabels() - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - finalResponse := inspectHTTPResponse(resp) - if resp != nil { - assert.Equal( - 200, resp.StatusCode, finalResponse) - } - // "beta.kubernetes.io/arch" is a label of our nodes and is expected - assert.True( - strings.Contains(finalResponse, "beta.kubernetes.io/arch"), - finalResponse) -} - -func GetPodEvents(nameSpace string, tenant string, podName string) (*http.Response, error) { - /* - Helper function to get events for pod - URL: /namespaces/{namespace}/tenants/{tenant}/pods/{podName}/events - HTTP Verb: GET - */ - request, err := http.NewRequest( - "GET", "http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant+"/pods/"+podName+"/events", nil) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestGetPodEvents(t *testing.T) { - assert := assert.New(t) - namespace := "tenant-lite" - tenant := "storage-lite" - podName := "storage-lite-pool-0-0" - resp, err := GetPodEvents(namespace, tenant, podName) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 200, resp.StatusCode, "Status Code is incorrect") - } -} - -func GetPodDescribe(nameSpace string, tenant string, podName string) (*http.Response, error) { - /* - Helper function to get events for pod - URL: /namespaces/{namespace}/tenants/{tenant}/pods/{podName}/events - HTTP Verb: GET - */ - fmt.Println(nameSpace) - fmt.Println(tenant) - fmt.Println(podName) - request, err := http.NewRequest( - "GET", "http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant+"/pods/"+podName+"/describe", nil) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestGetPodDescribe(t *testing.T) { - assert := assert.New(t) - namespace := "tenant-lite" - tenant := "storage-lite" - podName := "storage-lite-pool-0-0" - resp, err := GetPodDescribe(namespace, tenant, podName) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - finalResponse := inspectHTTPResponse(resp) - if resp != nil { - assert.Equal( - 200, resp.StatusCode, finalResponse) - } - /*if resp != nil { - assert.Equal( - 200, resp.StatusCode, "Status Code is incorrect") - }*/ -} - -func GetCSR(nameSpace string, tenant string) (*http.Response, error) { - /* - Helper function to get events for pod - URL: /namespaces/{namespace}/tenants/{tenant}/csr - HTTP Verb: GET - */ - request, err := http.NewRequest( - "GET", "http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant+"/csr/", nil) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestGetCSR(t *testing.T) { - assert := assert.New(t) - namespace := "tenant-lite" - tenant := "storage-lite" - resp, err := GetCSR(namespace, tenant) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - finalResponse := inspectHTTPResponse(resp) - if resp != nil { - assert.Equal( - 200, resp.StatusCode, finalResponse) - } - assert.Equal(strings.Contains(finalResponse, "Automatically approved by MinIO Operator"), true, finalResponse) -} - -func TestGetMultipleCSRs(t *testing.T) { - /* - We can have multiple CSRs per tenant, the idea is to support them in our API and test them here, making sure we - can retrieve them all, as an example I found this tenant: - storage-kms-encrypted -client -tenant-kms-encrypted-csr - storage-kms-encrypted -kes -tenant-kms-encrypted-csr - storage-kms-encrypted -tenant-kms-encrypted-csr - Notice the nomenclature of it: - -<*>--csr - where * is anything either nothing or something, anything. - */ - assert := assert.New(t) - namespace := "tenant-kms-encrypted" - tenant := "storage-kms-encrypted" - resp, err := GetCSR(namespace, tenant) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - finalResponse := inspectHTTPResponse(resp) - if resp != nil { - assert.Equal( - 200, resp.StatusCode, finalResponse) - } - var expectedMessages [3]string - expectedMessages[0] = "storage-kms-encrypted-tenant-kms-encrypted-csr" - expectedMessages[1] = "storage-kms-encrypted-kes-tenant-kms-encrypted-csr" - expectedMessages[2] = "Automatically approved by MinIO Operator" - for _, element := range expectedMessages { - assert.Equal(strings.Contains(finalResponse, element), true) - } -} - -func ListPVCsForTenant(nameSpace string, tenant string) (*http.Response, error) { - /* - URL: /namespaces/{namespace}/tenants/{tenant}/pvcs - HTTP Verb: GET - */ - request, err := http.NewRequest( - "GET", "http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant+"/pvcs/", nil) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestListPVCsForTenant(t *testing.T) { - /* - Function to list and verify the Tenant's Persistent Volume Claims - */ - assert := assert.New(t) - namespace := "tenant-lite" - tenant := "storage-lite" - resp, err := ListPVCsForTenant(namespace, tenant) - bodyResponse := resp.Body - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 200, resp.StatusCode, "failed") - } - bodyBytes, _ := ioutil.ReadAll(bodyResponse) - listObjs := models.ListPVCsResponse{} - err = json.Unmarshal(bodyBytes, &listObjs) - if err != nil { - log.Println(err) - assert.Nil(err) - } - var pvcArray [4]string - pvcArray[0] = "data0-storage-lite-pool-0-0" - pvcArray[1] = "data0-storage-lite-pool-0-1" - pvcArray[2] = "data0-storage-lite-pool-0-2" - pvcArray[3] = "data0-storage-lite-pool-0-3" - for i := 0; i < len(pvcArray); i++ { - assert.Equal(strings.Contains(listObjs.Pvcs[i].Name, pvcArray[i]), true) - } -} - -func CreateNamespace(nameSpace string) (*http.Response, error) { - /* - Description: Creates a new Namespace with given information - URL: /namespace - HTTP Verb: POST - */ - requestDataAdd := map[string]interface{}{ - "name": nameSpace, - } - requestDataJSON, _ := json.Marshal(requestDataAdd) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "POST", - "http://localhost:9090/api/v1/namespace/", - requestDataBody, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestCreateNamespace(t *testing.T) { - /* - Function to Create a Namespace only once. - */ - assert := assert.New(t) - namespace := "new-namespace-thujun2208pm" - tests := []struct { - name string - nameSpace string - expectedStatus int - }{ - { - name: "Create Namespace for the first time", - expectedStatus: 201, - nameSpace: namespace, - }, - { - name: "Create repeated namespace for second time", - expectedStatus: 500, - nameSpace: namespace, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - resp, err := CreateNamespace(tt.nameSpace) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - tt.expectedStatus, resp.StatusCode, "failed") - } else { - assert.Fail("resp cannot be nil") - } - }) - } -} - -func LoginOperator() (*http.Response, error) { - /* - Description: Login to Operator Console. - URL: /login/operator - Params in the Body: jwt - */ - requestData := map[string]string{ - "jwt": jwt, - } - fmt.Println("requestData: ", requestData) - - requestDataJSON, _ := json.Marshal(requestData) - - requestDataBody := bytes.NewReader(requestDataJSON) - - request, err := http.NewRequest("POST", "http://localhost:9090/api/v1/login/operator", requestDataBody) - if err != nil { - log.Println(err) - } - - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func LogoutOperator() (*http.Response, error) { - /* - Description: Logout from Operator. - URL: /logout - */ - request, err := http.NewRequest( - "POST", - "http://localhost:9090/api/v1/logout", - nil, - ) - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - if err != nil { - log.Println(err) - } - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestLogout(t *testing.T) { - // Vars - assert := assert.New(t) - - // 1. Logout - response, err := LogoutOperator() - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal( - 200, - response.StatusCode, - inspectHTTPResponse(response), - ) - } - - // 2. Login to recover token - response, err = LoginOperator() - if err != nil { - log.Println(err) - return - } - if response != nil { - for _, cookie := range response.Cookies() { - if cookie.Name == "token" { - token = cookie.Value - break - } - } - } - - // Verify token - if token == "" { - assert.Fail("authentication token not found in cookies response") - } -} - -func EnableTenantLogging(namespace, tenant string) (*http.Response, error) { - /* - Description: Enable Tenant Logging - HTTP Verb: POST - */ - request, err := http.NewRequest( - "POST", - "http://localhost:9090/api/v1/namespaces/"+namespace+"/tenants/"+tenant+"/enable-logging", - nil, - ) - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - if err != nil { - log.Println(err) - } - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func DisableTenantLogging(namespace, tenant string) (*http.Response, error) { - /* - Description: Disable Tenant Logging - */ - request, err := http.NewRequest( - "POST", - "http://localhost:9090/api/v1/namespaces/"+namespace+"/tenants/"+tenant+"/disable-logging", - nil, - ) - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - if err != nil { - log.Println(err) - } - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestEnableTenantLogging(t *testing.T) { - // Vars - assert := assert.New(t) - namespace := "tenant-lite" - tenant := "storage-lite" - - // Enable tenant logging - resp, err := EnableTenantLogging(namespace, tenant) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 200, - resp.StatusCode, - inspectHTTPResponse(resp), - ) - } -} - -func TestDisableTenantLogging(t *testing.T) { - // Vars - assert := assert.New(t) - namespace := "tenant-lite" - tenant := "storage-lite" - - // Disable tenant logging - resp, err := DisableTenantLogging(namespace, tenant) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 200, - resp.StatusCode, - inspectHTTPResponse(resp), - ) - } -} - -func GetTenantLogs(nameSpace, tenant string) (*http.Response, error) { - /* - URL: /namespaces/{namespace}/tenants/{tenant}/log - summary: Get Tenant Logs - HTTP Verb:GET - */ - request, err := http.NewRequest( - "GET", - "http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant+"/log", - nil, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func SetTenantLogs(labels, annotations, nodeSelector, dbLabels, dbAnnotations, dbNodeSelector []string, nameSpace, tenant, dbServiceAccountName, logMemRequest, logDBMemRequest, diskCapacityGB, serviceAccountName string) (*http.Response, error) { - /* - URL: /namespaces/{namespace}/tenants/{tenant}/log - summary: Set Tenant Logs - HTTP Verb: PUT - */ - requestDataAdd := map[string]interface{}{ - "labels": labels, - "annotations": annotations, - "dbAnnotations": dbAnnotations, - "dbLabels": dbLabels, - "dbNodeSelector": dbNodeSelector, - "diskCapacityGB": diskCapacityGB, - "nodeSelector": nodeSelector, - "serviceAccountName": serviceAccountName, - "dbServiceAccountName": dbServiceAccountName, - "logMemRequest": logMemRequest, - "logDBMemRequest": logDBMemRequest, - } - requestDataJSON, _ := json.Marshal(requestDataAdd) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "PUT", - "http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant+"/log", - requestDataBody, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestGetTenantLogs(t *testing.T) { - // Vars - assert := assert.New(t) - namespace := "tenant-lite" - tenant := "storage-lite" - - // Get Log Settings - resp, err := GetTenantLogs(namespace, tenant) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 200, - resp.StatusCode, - inspectHTTPResponse(resp), - ) - } -} - -func TestSetTenantLogs(t *testing.T) { - // Vars - assert := assert.New(t) - nameSpace := "tenant-lite" - tenant := "storage-lite" - var nodeSelector []string - var labels []string - var annotations []string - var dbAnnotations []string - var dbNodeSelector []string - var dbLabels []string - diskCapacityGB := "2" - dbServiceAccountName := "" - logMemRequest := "0Gi" - logDBMemRequest := "0Gi" - serviceAccountName := "" - - // Set Tenant Logs - resp, err := SetTenantLogs( - labels, - annotations, - nodeSelector, - dbLabels, - dbAnnotations, - dbNodeSelector, - nameSpace, - tenant, - dbServiceAccountName, - logMemRequest, - logDBMemRequest, - diskCapacityGB, - serviceAccountName, - ) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 200, - resp.StatusCode, - inspectHTTPResponse(resp), - ) - } -} - -func TenantDetails(nameSpace, tenant string) (*http.Response, error) { - /* - url: /namespaces/{namespace}/tenants/{tenant} - summary: Tenant Details - operationId: TenantDetails - HTTP Verb: GET - */ - request, err := http.NewRequest( - "GET", - "http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant, - nil, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestTenantDetails(t *testing.T) { - // Vars - assert := assert.New(t) - nameSpace := "tenant-lite" - tenant := "storage-lite" - resp, err := TenantDetails(nameSpace, tenant) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 200, - resp.StatusCode, - inspectHTTPResponse(resp), - ) - } -} diff --git a/operatorapi/auth/operator.go b/operatorapi/auth/operator.go deleted file mode 100644 index 3fa74053c..000000000 --- a/operatorapi/auth/operator.go +++ /dev/null @@ -1,91 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package auth - -import ( - "context" - - errors "github.com/minio/console/restapi" - - "github.com/minio/console/cluster" - "github.com/minio/minio-go/v7/pkg/credentials" - operatorClientset "github.com/minio/operator/pkg/client/clientset/versioned" -) - -// operatorCredentialsProvider is an struct to hold the JWT (service account token) -type operatorCredentialsProvider struct { - serviceAccountJWT string -} - -// Implementing the interfaces of the minio Provider, we use this to leverage on the existing console Authentication flow -func (s operatorCredentialsProvider) Retrieve() (credentials.Value, error) { - return credentials.Value{ - AccessKeyID: "", - SecretAccessKey: "", - SessionToken: s.serviceAccountJWT, - }, nil -} - -// IsExpired dummy function, must be implemented in order to work with the minio provider authentication -func (s operatorCredentialsProvider) IsExpired() bool { - return false -} - -// OperatorClient interface with all functions to be implemented -// by mock when testing, it should include all OperatorClient respective api calls -// that are used within this project. -type OperatorClient interface { - Authenticate(context.Context) ([]byte, error) -} - -// Interface implementation -// -// Define the structure of a operator client and define the functions that are actually used -// from the minio operator. -type operatorClient struct { - client *operatorClientset.Clientset -} - -// Authenticate implements the operator authenticate function via REST /api -func (c *operatorClient) Authenticate(ctx context.Context) ([]byte, error) { - return c.client.RESTClient().Verb("GET").RequestURI("/api").DoRaw(ctx) -} - -// checkServiceAccountTokenValid will make an authenticated request against kubernetes api, if the -// request success means the provided jwt its a valid service account token and the console user can use it for future -// requests until it expires -func checkServiceAccountTokenValid(ctx context.Context, operatorClient OperatorClient) error { - _, err := operatorClient.Authenticate(ctx) - return err -} - -// GetConsoleCredentialsForOperator will validate the provided JWT (service account token) and return it in the form of credentials.Login -func GetConsoleCredentialsForOperator(jwt string) (*credentials.Credentials, error) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - opClientClientSet, err := cluster.OperatorClient(jwt) - if err != nil { - return nil, err - } - opClient := &operatorClient{ - client: opClientClientSet, - } - if err = checkServiceAccountTokenValid(ctx, opClient); err != nil { - return nil, errors.ErrInvalidLogin - } - return credentials.New(operatorCredentialsProvider{serviceAccountJWT: jwt}), nil -} diff --git a/operatorapi/auth/operator_test.go b/operatorapi/auth/operator_test.go deleted file mode 100644 index f6e6b296d..000000000 --- a/operatorapi/auth/operator_test.go +++ /dev/null @@ -1,102 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package auth - -import ( - "context" - "errors" - "testing" - - "github.com/minio/console/cluster" - operatorClientset "github.com/minio/operator/pkg/client/clientset/versioned" -) - -type operatorClientTest struct { - client *operatorClientset.Clientset -} - -var operatorAuthenticateMock func(ctx context.Context) ([]byte, error) - -// TenantDelete implements the minio instance delete action from minio-operator -func (c *operatorClientTest) Authenticate(ctx context.Context) ([]byte, error) { - return operatorAuthenticateMock(ctx) -} - -func Test_checkServiceAccountTokenValid(t *testing.T) { - successResponse := func() { - operatorAuthenticateMock = func(ctx context.Context) ([]byte, error) { - return nil, nil - } - } - - failResponse := func() { - operatorAuthenticateMock = func(ctx context.Context) ([]byte, error) { - return nil, errors.New("something went wrong") - } - } - - opClientClientSet, _ := cluster.OperatorClient("") - - opClient := &operatorClientTest{ - client: opClientClientSet, - } - - type args struct { - ctx context.Context - operatorClient *operatorClientTest - mockFunction func() - } - tests := []struct { - name string - args args - want bool - }{ - { - name: "Success authentication - correct jwt (service account token)", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - mockFunction: successResponse, - }, - want: true, - }, - { - name: "Fail authentication - incorrect jwt (service account token)", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - mockFunction: failResponse, - }, - want: false, - }, - } - for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { - if tt.args.mockFunction != nil { - tt.args.mockFunction() - } - got := checkServiceAccountTokenValid(tt.args.ctx, tt.args.operatorClient) - if got != nil && tt.want { - t.Errorf("checkServiceAccountTokenValid() = expected success but got %s", got) - } - if got == nil && !tt.want { - t.Error("checkServiceAccountTokenValid() = expected failure but got success") - } - }) - } -} diff --git a/operatorapi/config.go b/operatorapi/config.go deleted file mode 100644 index 4f826453a..000000000 --- a/operatorapi/config.go +++ /dev/null @@ -1,77 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "crypto/x509" - "io/ioutil" - "time" - - xcerts "github.com/minio/pkg/certs" - - "github.com/minio/pkg/env" -) - -var ( - // Port console default port - Port = "9090" - - // Hostname console hostname - // avoid listening on 0.0.0.0 by default - // instead listen on all IPv4 and IPv6 - // - Hostname should be empty. - Hostname = "" - - // TLSPort console tls port - TLSPort = "9443" - - // TLSRedirect console tls redirect rule - TLSRedirect = "on" - - // SessionDuration cookie validity duration - SessionDuration = 45 * time.Minute - - // LicenseKey in memory license key used by console ui - LicenseKey = "" - // GlobalRootCAs is CA root certificates, a nil value means system certs pool will be used - GlobalRootCAs *x509.CertPool - // GlobalPublicCerts has certificates Console will use to serve clients - GlobalPublicCerts []*x509.Certificate - // GlobalTLSCertsManager custom TLS Manager for SNI support - GlobalTLSCertsManager *xcerts.Manager -) - -// getK8sSAToken assumes the plugin is running inside a k8s pod and extract the current service account from the -// /var/run/secrets/kubernetes.io/serviceaccount/token file -func getK8sSAToken() string { - dat, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/token") - if err != nil { - return env.Get(ConsoleOperatorSAToken, "") - } - return string(dat) -} - -// Get Marketplace deployment platform -func getMarketplace() string { - return env.Get(ConsoleMarketplace, "") -} - -// Get DirectPVMode -func getDirectPVEnabled() bool { - currentMode := env.Get(DirectPVMode, "off") - return currentMode == "on" -} diff --git a/operatorapi/config_test.go b/operatorapi/config_test.go deleted file mode 100644 index 680cfb5ed..000000000 --- a/operatorapi/config_test.go +++ /dev/null @@ -1,136 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2022 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "os" - "testing" - - "github.com/stretchr/testify/assert" -) - -func Test_getK8sSAToken(t *testing.T) { - tests := []struct { - name string - want string - envs map[string]string - }{ - { - name: "Missing file, empty", - want: "", - envs: nil, - }, - { - name: "Missing file, return env", - want: "x", - envs: map[string]string{ - ConsoleOperatorSAToken: "x", - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if tt.envs != nil { - for k, v := range tt.envs { - os.Setenv(k, v) - } - } - if got := getK8sSAToken(); got != tt.want { - t.Errorf("getK8sSAToken() = %v, want %v", got, tt.want) - } - if tt.envs != nil { - for k := range tt.envs { - os.Unsetenv(k) - } - } - }) - } -} - -func Test_getMarketplace(t *testing.T) { - tests := []struct { - name string - want string - envs map[string]string - }{ - { - name: "Nothing set", - want: "", - envs: nil, - }, - { - name: "Value set", - want: "x", - envs: map[string]string{ - ConsoleMarketplace: "x", - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if tt.envs != nil { - for k, v := range tt.envs { - os.Setenv(k, v) - } - } - if got := getMarketplace(); got != tt.want { - t.Errorf("getMarketplace() = %v, want %v", got, tt.want) - } - if tt.envs != nil { - for k := range tt.envs { - os.Unsetenv(k) - } - } - }) - } -} - -func Test_getDirectPVEnabled(t *testing.T) { - type args struct { - setEnv bool - } - tests := []struct { - name string - want bool - args args - }{ - { - name: "DirectPV Mode is Set", - want: true, - args: args{ - setEnv: true, - }, - }, - { - name: "DirectPV Mode is not set", - want: false, - args: args{ - setEnv: false, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if tt.args.setEnv { - os.Setenv(DirectPVMode, "on") - } else { - os.Unsetenv(DirectPVMode) - } - assert.Equalf(t, tt.want, getDirectPVEnabled(), "getDirectPVEnabled()") - }) - } -} diff --git a/operatorapi/configure_operator.go b/operatorapi/configure_operator.go deleted file mode 100644 index f8249afed..000000000 --- a/operatorapi/configure_operator.go +++ /dev/null @@ -1,177 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operatorapi - -import ( - "crypto/tls" - "net/http" - "strings" - - "github.com/klauspost/compress/gzhttp" - "github.com/minio/console/restapi" - "github.com/unrolled/secure" - - "github.com/minio/console/pkg/auth" - - "github.com/go-openapi/swag" - - "github.com/go-openapi/errors" - - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations" -) - -//go:generate swagger generate server --target ../../console --name Operator --spec ../swagger-operator.yml --server-package operatorapi --principal models.Principal --exclude-main - -var additionalServerFlags = struct { - CertsDir string `long:"certs-dir" description:"path to certs directory" env:"CONSOLE_CERTS_DIR"` -}{} - -func configureFlags(api *operations.OperatorAPI) { - api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ - { - ShortDescription: "additional server flags", - Options: &additionalServerFlags, - }, - } -} - -func configureAPI(api *operations.OperatorAPI) http.Handler { - // Applies when the "x-token" header is set - api.KeyAuth = func(token string, scopes []string) (*models.Principal, error) { - // we are validating the session token by decrypting the claims inside, if the operation succeed that means the jwt - // was generated and signed by us in the first place - claims, err := auth.ParseClaimsFromToken(token) - if err != nil { - api.Logger("Unable to validate the session token %s: %v", token, err) - return nil, errors.New(401, "incorrect api key auth") - } - return &models.Principal{ - STSAccessKeyID: claims.STSAccessKeyID, - STSSecretAccessKey: claims.STSSecretAccessKey, - STSSessionToken: claims.STSSessionToken, - AccountAccessKey: claims.AccountAccessKey, - }, nil - } - // Register logout handlers - registerLogoutHandlers(api) - // Register login handlers - registerLoginHandlers(api) - registerSessionHandlers(api) - registerVersionHandlers(api) - - // Operator Console - // Register tenant handlers - registerTenantHandlers(api) - // Register ResourceQuota handlers - registerResourceQuotaHandlers(api) - // Register Nodes' handlers - registerNodesHandlers(api) - // Register Parity' handlers - registerParityHandlers(api) - - // Volumes handlers - registerVolumesHandlers(api) - // Namespaces handlers - registerNamespaceHandlers(api) - // Marketplace handlers - registerMarketplaceHandlers(api) - // Subnet handlers - registerOperatorSubnetHandlers(api) - // Direct PV handlers - registerDirectPVHandlers(api) - - api.PreServerShutdown = func() {} - - api.ServerShutdown = func() {} - - return setupGlobalMiddleware(api.Serve(setupMiddlewares)) -} - -// The TLS configuration before HTTPS server starts. -func configureTLS(tlsConfig *tls.Config) { - tlsConfig.RootCAs = restapi.GlobalRootCAs - tlsConfig.GetCertificate = restapi.GlobalTLSCertsManager.GetCertificate -} - -// As soon as server is initialized but not run yet, this function will be called. -// If you need to modify a config, store server instance to stop it individually later, this is the place. -// This function can be called multiple times, depending on the number of serving schemes. -// scheme value will be set accordingly: "http", "https" or "unix". -func configureServer(s *http.Server, scheme, addr string) { -} - -// The middleware configuration is for the handler executors. These do not apply to the swagger.json document. -// The middleware executes after routing but before authentication, binding and validation. -func setupMiddlewares(handler http.Handler) http.Handler { - return handler -} - -// proxyMiddleware adds the proxy capability -func proxyMiddleware(next http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if strings.HasPrefix(r.URL.Path, "/api/proxy") || strings.HasPrefix(r.URL.Path, "/api/hop") { - serveProxy(w, r) - } else { - next.ServeHTTP(w, r) - } - }) -} - -// The middleware configuration happens before anything, this middleware also applies to serving the swagger.json document. -// So this is a good place to plug in a panic handling middleware, logging and metrics. -func setupGlobalMiddleware(handler http.Handler) http.Handler { - // proxy requests - next := proxyMiddleware(handler) - // if audit-log is enabled console will log all incoming request - next = restapi.AuditLogMiddleware(next) - // serve static files - next = restapi.FileServerMiddleware(next) - // add information to request context - next = restapi.ContextMiddleware(next) - // handle cookie or authorization header for session - next = restapi.AuthenticationMiddleware(next) - // Secure middleware, this middleware wrap all the previous handlers and add - // HTTP security headers - secureOptions := secure.Options{ - AllowedHosts: restapi.GetSecureAllowedHosts(), - AllowedHostsAreRegex: restapi.GetSecureAllowedHostsAreRegex(), - HostsProxyHeaders: restapi.GetSecureHostsProxyHeaders(), - SSLRedirect: restapi.GetTLSRedirect() == "on" && len(restapi.GlobalPublicCerts) > 0, - SSLHost: restapi.GetSecureTLSHost(), - STSSeconds: restapi.GetSecureSTSSeconds(), - STSIncludeSubdomains: restapi.GetSecureSTSIncludeSubdomains(), - STSPreload: restapi.GetSecureSTSPreload(), - SSLTemporaryRedirect: restapi.GetSecureTLSTemporaryRedirect(), - SSLHostFunc: nil, - ForceSTSHeader: restapi.GetSecureForceSTSHeader(), - FrameDeny: restapi.GetSecureFrameDeny(), - ContentTypeNosniff: restapi.GetSecureContentTypeNonSniff(), - BrowserXssFilter: restapi.GetSecureBrowserXSSFilter(), - ContentSecurityPolicy: restapi.GetSecureContentSecurityPolicy(), - ContentSecurityPolicyReportOnly: restapi.GetSecureContentSecurityPolicyReportOnly(), - PublicKey: restapi.GetSecurePublicKey(), - ReferrerPolicy: restapi.GetSecureReferrerPolicy(), - FeaturePolicy: restapi.GetSecureFeaturePolicy(), - ExpectCTHeader: restapi.GetSecureExpectCTHeader(), - IsDevelopment: false, - } - secureMiddleware := secure.New(secureOptions) - next = secureMiddleware.Handler(next) - return gzhttp.GzipHandler(next) -} diff --git a/operatorapi/consts.go b/operatorapi/consts.go deleted file mode 100644 index acefff57a..000000000 --- a/operatorapi/consts.go +++ /dev/null @@ -1,36 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -// list of all console environment constants -const ( - ConsoleOperatorSAToken = "CONSOLE_OPERATOR_SA_TOKEN" - ConsoleMarketplace = "CONSOLE_OPERATOR_MARKETPLACE" - - // Constants for prometheus annotations - prometheusPath = "prometheus.io/path" - prometheusPort = "prometheus.io/port" - prometheusScrape = "prometheus.io/scrape" - - // Constants for DirectPV - DirectPVMode = "DIRECTPV_MODE" -) - -// Image versions -const ( - KESImageVersion = "minio/kes:v0.17.6" -) diff --git a/operatorapi/directpv.go b/operatorapi/directpv.go deleted file mode 100644 index e83ed76a3..000000000 --- a/operatorapi/directpv.go +++ /dev/null @@ -1,328 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2022 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "errors" - "sort" - "strings" - - "github.com/minio/directpv/pkg/utils" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/cluster" - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations" - "github.com/minio/console/operatorapi/operations/operator_api" - xerrors "github.com/minio/console/restapi" - directcsi "github.com/minio/directpv/pkg/apis/direct.csi.min.io/v1beta4" - "github.com/minio/directpv/pkg/sys" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -const XFS = "xfs" - -func registerDirectPVHandlers(api *operations.OperatorAPI) { - api.OperatorAPIGetDirectPVDriveListHandler = operator_api.GetDirectPVDriveListHandlerFunc(func(params operator_api.GetDirectPVDriveListParams, session *models.Principal) middleware.Responder { - resp, err := getDirectPVDrivesListResponse(session) - if err != nil { - return operator_api.NewGetDirectPVDriveListDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewGetDirectPVDriveListOK().WithPayload(resp) - }) - api.OperatorAPIGetDirectPVVolumeListHandler = operator_api.GetDirectPVVolumeListHandlerFunc(func(params operator_api.GetDirectPVVolumeListParams, session *models.Principal) middleware.Responder { - resp, err := getDirectPVVolumesListResponse(session) - if err != nil { - return operator_api.NewGetDirectPVVolumeListDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewGetDirectPVVolumeListOK().WithPayload(resp) - }) - api.OperatorAPIDirectPVFormatDriveHandler = operator_api.DirectPVFormatDriveHandlerFunc(func(params operator_api.DirectPVFormatDriveParams, session *models.Principal) middleware.Responder { - resp, err := formatVolumesResponse(session, params) - if err != nil { - return operator_api.NewDirectPVFormatDriveDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewDirectPVFormatDriveOK().WithPayload(resp) - }) -} - -// getDirectPVVolumesList returns directPV drives -func getDirectPVDriveList(ctx context.Context, driveInterface DirectPVDrivesClientI) (*models.GetDirectPVDriveListResponse, error) { - drivesList, err := driveInterface.List(ctx, metav1.ListOptions{}) - if err != nil { - return nil, err - } - res := &models.GetDirectPVDriveListResponse{} - - // implementation same as directPV `drives ls` command - driveName := func(val string) string { - dr := strings.ReplaceAll(val, sys.DirectCSIDevRoot+"/", "") - dr = strings.ReplaceAll(dr, sys.HostDevRoot+"/", "") - return strings.ReplaceAll(dr, sys.DirectCSIPartitionInfix, "") - } - drivesSorted := drivesList.Items - // sort by nodename, path and status - sort.Slice(drivesSorted, func(i, j int) bool { - d1 := drivesSorted[i] - d2 := drivesSorted[j] - - if v := strings.Compare(d1.Status.NodeName, d2.Status.NodeName); v != 0 { - return v < 0 - } - - if v := strings.Compare(d1.Status.Path, d2.Status.Path); v != 0 { - return v < 0 - } - - return strings.Compare(string(d1.Status.DriveStatus), string(d2.Status.DriveStatus)) < 0 - }) - - for _, d := range drivesSorted { - volumes := 0 - - if len(d.Finalizers) > 1 { - volumes = len(d.Finalizers) - 1 - } - - dr := driveName(d.Status.Path) - dr = strings.ReplaceAll("/dev/"+dr, sys.DirectCSIPartitionInfix, "") - - status := d.Status.DriveStatus - msg := "" - for _, c := range d.Status.Conditions { - switch c.Type { - case string(directcsi.DirectCSIDriveConditionInitialized), string(directcsi.DirectCSIDriveConditionOwned), string(directcsi.DirectCSIDriveConditionReady): - if c.Status != metav1.ConditionTrue { - msg = c.Message - if msg != "" { - status = d.Status.DriveStatus + "*" - msg = strings.ReplaceAll(msg, d.Name, "") - msg = strings.ReplaceAll(msg, sys.DirectCSIDevRoot, "/dev") - msg = strings.ReplaceAll(msg, sys.DirectCSIPartitionInfix, "") - msg = strings.Split(msg, "\n")[0] - } - } - } - } - - var allocatedCapacity int64 - if status == directcsi.DriveStatusInUse { - allocatedCapacity = d.Status.AllocatedCapacity - } - - drStatus := d.Status.DriveStatus - - driveInfo := &models.DirectPVDriveInfo{ - Drive: dr, - Capacity: d.Status.TotalCapacity, - Allocated: allocatedCapacity, - Node: d.Status.NodeName, - Status: string(drStatus), - Message: msg, - Volumes: int64(volumes), - } - res.Drives = append(res.Drives, driveInfo) - } - - return res, nil -} - -func getDirectPVDrivesListResponse(session *models.Principal) (*models.GetDirectPVDriveListResponse, *models.Error) { - ctx := context.Background() - - driveInterface, err := cluster.DirectPVDriveInterface(session.STSSessionToken) - if err != nil { - return nil, xerrors.ErrorWithContext(ctx, err) - } - - directPVDrvClient := &directPVDrivesClient{ - client: driveInterface, - } - - drives, err := getDirectPVDriveList(ctx, directPVDrvClient) - if err != nil { - return nil, xerrors.ErrorWithContext(ctx, err) - } - return drives, nil -} - -// getDirectPVVolumesList returns directPV volumes -func getDirectPVVolumesList(ctx context.Context, volumeInterface DirectPVVolumesClientI) (*models.GetDirectPVVolumeListResponse, error) { - volList, err := volumeInterface.List(ctx, metav1.ListOptions{}) - if err != nil { - return nil, err - } - - driveName := func(val string) string { - dr := strings.ReplaceAll(val, sys.DirectCSIDevRoot+"/", "") - return strings.ReplaceAll(dr, sys.HostDevRoot+"/", "") - } - - getLabelValue := func(obj metav1.Object, key string) string { - if labels := obj.GetLabels(); labels != nil { - return labels[key] - } - return "" - } - - var volumes []*models.DirectPVVolumeInfo - for _, v := range volList.Items { - vol := &models.DirectPVVolumeInfo{ - Volume: v.Name, - Capacity: v.Status.TotalCapacity, - Drive: driveName(getLabelValue(&v, string(utils.DrivePathLabelKey))), - Node: v.Status.NodeName, - } - - volumes = append(volumes, vol) - } - - res := &models.GetDirectPVVolumeListResponse{ - Volumes: volumes, - } - return res, nil -} - -func getDirectPVVolumesListResponse(session *models.Principal) (*models.GetDirectPVVolumeListResponse, *models.Error) { - ctx := context.Background() - - volumeInterface, err := cluster.DirectPVVolumeInterface(session.STSSessionToken) - if err != nil { - return nil, xerrors.ErrorWithContext(ctx, err) - } - - directPVVolClient := &directPVVolumesClient{ - client: volumeInterface, - } - - volumes, err := getDirectPVVolumesList(ctx, directPVVolClient) - if err != nil { - return nil, xerrors.ErrorWithContext(ctx, err) - } - return volumes, nil -} - -func formatDrives(ctx context.Context, driveInterface DirectPVDrivesClientI, drives []string, force bool) (*models.FormatDirectPVDrivesResponse, error) { - if len(drives) == 0 { - return nil, errors.New("at least one drive needs to be set") - } - - driveList, err := driveInterface.List(ctx, metav1.ListOptions{}) - if err != nil { - return nil, err - } - - driveName := func(val string) string { - dr := strings.ReplaceAll(val, sys.DirectCSIDevRoot+"/", "") - dr = strings.ReplaceAll(dr, sys.HostDevRoot+"/", "") - return strings.ReplaceAll(dr, sys.DirectCSIPartitionInfix, "") - } - - drivesArray := map[string]string{} - - for _, driveFromAPI := range drives { - drivesArray[driveFromAPI] = driveFromAPI - } - - if len(driveList.Items) == 0 { - return nil, errors.New("no resources found globally") - } - - var errorResponses []*models.PvFormatErrorResponse - - for _, driveItem := range driveList.Items { - drName := "/dev/" + driveName(driveItem.Status.Path) - driveName := driveItem.Status.NodeName + ":" + drName - - base := &models.PvFormatErrorResponse{ - Node: driveItem.Status.NodeName, - Drive: drName, - Error: "", - } - - // Element is requested to be formatted - if _, ok := drivesArray[driveName]; ok { - if driveItem.Status.DriveStatus == directcsi.DriveStatusUnavailable { - base.Error = "Status is unavailable" - errorResponses = append(errorResponses, base) - continue - } - - if driveItem.Status.DriveStatus == directcsi.DriveStatusInUse { - base.Error = "Drive in use. Cannot be formatted" - errorResponses = append(errorResponses, base) - continue - } - - if driveItem.Status.DriveStatus == directcsi.DriveStatusReady { - base.Error = "Drive already owned and managed." - errorResponses = append(errorResponses, base) - continue - } - if driveItem.Status.Filesystem != "" && !force { - base.Error = "Drive already has a fs. Use force to overwrite" - errorResponses = append(errorResponses, base) - continue - } - - if driveItem.Status.DriveStatus == directcsi.DriveStatusReleased { - base.Error = "Drive is in 'released state'. Please wait until it becomes available" - errorResponses = append(errorResponses, base) - continue - } - - // Validation passes, we request format - driveItem.Spec.DirectCSIOwned = true - driveItem.Spec.RequestedFormat = &directcsi.RequestedFormat{ - Filesystem: XFS, - Force: force, - } - - _, err := driveInterface.Update(ctx, &driveItem, metav1.UpdateOptions{}) - if err != nil { - base.Error = err.Error() - errorResponses = append(errorResponses, base) - } - } - } - - returnErrors := &models.FormatDirectPVDrivesResponse{ - FormatIssuesList: errorResponses, - } - - return returnErrors, nil -} - -func formatVolumesResponse(session *models.Principal, params operator_api.DirectPVFormatDriveParams) (*models.FormatDirectPVDrivesResponse, *models.Error) { - ctx := context.Background() - - driveInterface, err := cluster.DirectPVDriveInterface(session.STSSessionToken) - if err != nil { - return nil, xerrors.ErrorWithContext(ctx, err) - } - - directPVDrvClient := &directPVDrivesClient{ - client: driveInterface, - } - - formatResult, errFormat := formatDrives(ctx, directPVDrvClient, params.Body.Drives, *params.Body.Force) - if errFormat != nil { - return nil, xerrors.ErrorWithContext(ctx, errFormat) - } - return formatResult, nil -} diff --git a/operatorapi/directpv_client.go b/operatorapi/directpv_client.go deleted file mode 100644 index 647400e04..000000000 --- a/operatorapi/directpv_client.go +++ /dev/null @@ -1,73 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2022 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - - "github.com/minio/directpv/pkg/apis/direct.csi.min.io/v1beta4" - directPVClient "github.com/minio/directpv/pkg/client" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// DirectPVDrivesClientI interface with all functions to be implemented -// by mock when testing, it should include all DirectPVDrivesClientI respective api calls -// that are used within this project. -type DirectPVDrivesClientI interface { - List(ctx context.Context, opts metav1.ListOptions) (*v1beta4.DirectCSIDriveList, error) - Update(ctx context.Context, driveItem *v1beta4.DirectCSIDrive, opts metav1.UpdateOptions) (*v1beta4.DirectCSIDriveList, error) -} - -// Interface implementation -// -// Define the structure of directpv drive client and define the functions that are actually used -// from the minio operator / directpv interface. - -type directPVDrivesClient struct { - client *directPVClient.DirectCSIDriveInterface -} - -// List implements the listing for DirectPV Drives List functionality -func (dpd *directPVDrivesClient) List(ctx context.Context, opts metav1.ListOptions) (*v1beta4.DirectCSIDriveList, error) { - return dpd.List(ctx, opts) -} - -// Update implements the listing for DirectPV Drives Update functionality -func (dpd *directPVDrivesClient) Update(ctx context.Context, driveItem *v1beta4.DirectCSIDrive, opts metav1.UpdateOptions) (*v1beta4.DirectCSIDriveList, error) { - return dpd.Update(ctx, driveItem, opts) -} - -// DirectPVVolumesClientI interface with all functions to be implemented -// by mock when testing, it should include all DirectPVVolumesClientI respective api calls -// that are used within this project. -type DirectPVVolumesClientI interface { - List(ctx context.Context, opts metav1.ListOptions) (*v1beta4.DirectCSIVolumeList, error) -} - -// Interface implementation -// -// Define the structure of directpv volumes client and define the functions that are actually used -// from the minio operator / directpv interface. - -type directPVVolumesClient struct { - client *directPVClient.DirectCSIVolumeInterface -} - -// List implements the listing for DirectPV Volumes List functionality -func (dpv *directPVVolumesClient) List(ctx context.Context, opts metav1.ListOptions) (*v1beta4.DirectCSIVolumeList, error) { - return dpv.List(ctx, opts) -} diff --git a/operatorapi/directpv_test.go b/operatorapi/directpv_test.go deleted file mode 100644 index 436f781e9..000000000 --- a/operatorapi/directpv_test.go +++ /dev/null @@ -1,410 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2022 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "errors" - "testing" - - "github.com/minio/directpv/pkg/apis/direct.csi.min.io/v1beta4" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -var ( - dpdClientListMock func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) - dpdClientUpdateMock func(ctx context.Context, driveItem *v1beta4.DirectCSIDrive, opts v1.UpdateOptions) (*v1beta4.DirectCSIDriveList, error) -) - -// mock function for drives List() -func (dpdm directPVDriveMock) List(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) { - return dpdClientListMock(ctx, opts) -} - -func (dpdm directPVDriveMock) Update(ctx context.Context, driveItem *v1beta4.DirectCSIDrive, opts v1.UpdateOptions) (*v1beta4.DirectCSIDriveList, error) { - return dpdClientUpdateMock(ctx, driveItem, opts) -} - -var dpvClientListMock func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIVolumeList, error) - -// mock function for volumes List() -func (dpvm directPVVolumeMock) List(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIVolumeList, error) { - return dpvClientListMock(ctx, opts) -} - -// DirectPVDrivesList -func Test_GetDirectPVDrives(t *testing.T) { - directPVDrvMock := directPVDriveMock{} - - type args struct { - ctx context.Context - opts v1.ListOptions - } - tests := []struct { - name string - args args - client DirectPVDrivesClientI - mockListDrives func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) - wantErr bool - }{ - { - name: "Can List Drives correctly", - args: args{ - ctx: context.Background(), - opts: v1.ListOptions{}, - }, - client: directPVDrvMock, - mockListDrives: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) { - items := []v1beta4.DirectCSIDrive{} - - returnList := v1beta4.DirectCSIDriveList{ - Items: items, - } - - return &returnList, nil - }, - wantErr: false, - }, - { - name: "Drives request from DirectPV failed", - args: args{ - ctx: context.Background(), - }, - client: directPVDrvMock, - mockListDrives: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) { - return nil, errors.New("some error occurred") - }, - wantErr: true, - }, - { - name: "Drives request from DirectPV has information and doesn't return errors", - args: args{ - ctx: context.Background(), - }, - client: directPVDrvMock, - mockListDrives: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) { - items := []v1beta4.DirectCSIDrive{ - { - Status: v1beta4.DirectCSIDriveStatus{ - Path: "/var/lib/direct-csi/devices/test-part-dev0-directcsi", - AllocatedCapacity: 0, - FreeCapacity: 4772382377372, - RootPartition: "/", - PartitionNum: 0, - Filesystem: "nfs", - Mountpoint: "", - NodeName: "test-dev0-directcsi", - DriveStatus: v1beta4.DriveStatusReady, - ModelNumber: "testModel", - SerialNumber: "testSN", - TotalCapacity: 4772382377372, - PhysicalBlockSize: 1024, - LogicalBlockSize: 1024, - AccessTier: "", - FilesystemUUID: "", - PartitionUUID: "", - MajorNumber: 0, - MinorNumber: 0, - UeventSerial: "", - UeventFSUUID: "", - WWID: "", - Vendor: "", - DMName: "", - DMUUID: "", - MDUUID: "", - PartTableUUID: "", - PartTableType: "", - Virtual: false, - ReadOnly: false, - Partitioned: false, - SwapOn: false, - Master: "", - OtherMountsInfo: nil, - PCIPath: "", - SerialNumberLong: "", - Conditions: []v1.Condition{{ - Type: "", - Status: "", - ObservedGeneration: 0, - LastTransitionTime: v1.Time{}, - Reason: "", - Message: "", - }}, - }, - }, - { - Status: v1beta4.DirectCSIDriveStatus{ - Path: "/var/lib/direct-csi/devices/test-part-dev1-directcsi", - AllocatedCapacity: 0, - FreeCapacity: 4772382377372, - RootPartition: "/", - PartitionNum: 0, - Filesystem: "nfs", - Mountpoint: "", - NodeName: "test-dev1-directcsi", - DriveStatus: v1beta4.DriveStatus(v1beta4.DirectCSIDriveConditionOwned), - ModelNumber: "testModel", - SerialNumber: "testSN2", - TotalCapacity: 4772382377372, - PhysicalBlockSize: 1024, - LogicalBlockSize: 1024, - AccessTier: "", - FilesystemUUID: "", - PartitionUUID: "", - MajorNumber: 0, - MinorNumber: 0, - UeventSerial: "", - UeventFSUUID: "", - WWID: "", - Vendor: "", - DMName: "", - DMUUID: "", - MDUUID: "", - PartTableUUID: "", - PartTableType: "", - Virtual: false, - ReadOnly: false, - Partitioned: false, - SwapOn: false, - Master: "", - OtherMountsInfo: nil, - PCIPath: "", - SerialNumberLong: "", - Conditions: nil, - }, - }, - } - - returnList := v1beta4.DirectCSIDriveList{ - Items: items, - } - - return &returnList, nil - }, - wantErr: false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - dpdClientListMock = tt.mockListDrives - - _, err := getDirectPVDriveList(tt.args.ctx, tt.client) - if (err != nil) != tt.wantErr { - t.Errorf("getNamespaceCreated() error = %v, wantErr %v", err, tt.wantErr) - } - }) - } -} - -// DirectPVVolumesList -func Test_GetDirectPVVolumes(t *testing.T) { - directPVVolMock := directPVVolumeMock{} - - type args struct { - ctx context.Context - opts v1.ListOptions - } - tests := []struct { - name string - args args - volumesClient DirectPVVolumesClientI - mockListVolumes func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIVolumeList, error) - wantErr bool - }{ - { - name: "Can List Volumes correctly", - args: args{ - ctx: context.Background(), - opts: v1.ListOptions{}, - }, - volumesClient: directPVVolMock, - mockListVolumes: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIVolumeList, error) { - items := []v1beta4.DirectCSIVolume{} - - returnList := v1beta4.DirectCSIVolumeList{ - Items: items, - } - - return &returnList, nil - }, - wantErr: false, - }, - { - name: "Drives request from DirectPV is ok but volumes request failed", - args: args{ - ctx: context.Background(), - }, - volumesClient: directPVVolMock, - mockListVolumes: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIVolumeList, error) { - return nil, errors.New("some error occurred") - }, - wantErr: true, - }, - { - name: "Can List Volumes & Drives correctly without any issue", - args: args{ - ctx: context.Background(), - opts: v1.ListOptions{}, - }, - volumesClient: directPVVolMock, - mockListVolumes: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIVolumeList, error) { - items := []v1beta4.DirectCSIVolume{{ - Status: v1beta4.DirectCSIVolumeStatus{ - Drive: "/var/lib/direct-csi/devices/test-part-dev1-directcsi", - NodeName: "testNodeName", - HostPath: "", - StagingPath: "", - ContainerPath: "", - TotalCapacity: 4772382377372, - AvailableCapacity: 4772382377372, - UsedCapacity: 0, - Conditions: nil, - }, - }} - - returnList := v1beta4.DirectCSIVolumeList{ - Items: items, - } - - return &returnList, nil - }, - wantErr: false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - dpvClientListMock = tt.mockListVolumes - - _, err := getDirectPVVolumesList(tt.args.ctx, tt.volumesClient) - if (err != nil) != tt.wantErr { - t.Errorf("getNamespaceCreated() error = %v, wantErr %v", err, tt.wantErr) - } - }) - } -} - -// FormatDrives -func Test_GetDirectPVFormatDrives(t *testing.T) { - directPVDrvMock := directPVDriveMock{} - - type args struct { - ctx context.Context - opts v1.ListOptions - } - tests := []struct { - name string - args args - drivesClient DirectPVDrivesClientI - mockListDrives func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) - drives []string - force bool - wantErr bool - }{ - { - name: "Format doesn't crash on empty list & returns error", - args: args{ - ctx: context.Background(), - opts: v1.ListOptions{}, - }, - drivesClient: directPVDrvMock, - mockListDrives: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) { - items := []v1beta4.DirectCSIDrive{} - - returnList := v1beta4.DirectCSIDriveList{ - Items: items, - } - - return &returnList, nil - }, - drives: []string{}, - force: false, - wantErr: true, - }, - { - name: "Can Format Selected drives", - args: args{ - ctx: context.Background(), - opts: v1.ListOptions{}, - }, - drivesClient: directPVDrvMock, - mockListDrives: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) { - items := []v1beta4.DirectCSIDrive{ - { - Status: v1beta4.DirectCSIDriveStatus{ - Path: "/var/lib/direct-csi/devices/test-part-dev1-directcsi", - AllocatedCapacity: 0, - FreeCapacity: 4772382377372, - RootPartition: "/", - PartitionNum: 0, - Filesystem: "nfs", - Mountpoint: "", - NodeName: "test-dev1-directcsi", - DriveStatus: v1beta4.DriveStatusAvailable, - ModelNumber: "testModel", - SerialNumber: "testSN2", - TotalCapacity: 4772382377372, - PhysicalBlockSize: 1024, - LogicalBlockSize: 1024, - AccessTier: "", - FilesystemUUID: "", - PartitionUUID: "", - MajorNumber: 0, - MinorNumber: 0, - UeventSerial: "", - UeventFSUUID: "", - WWID: "", - Vendor: "", - DMName: "", - DMUUID: "", - MDUUID: "", - PartTableUUID: "", - PartTableType: "", - Virtual: false, - ReadOnly: false, - Partitioned: false, - SwapOn: false, - Master: "", - OtherMountsInfo: nil, - PCIPath: "", - SerialNumberLong: "", - Conditions: nil, - }, - }, - } - - returnList := v1beta4.DirectCSIDriveList{ - Items: items, - } - - return &returnList, nil - }, - drives: []string{"test-dev1-directcsi:/dev/testdev1-directcsi"}, - force: false, - wantErr: false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - dpdClientListMock = tt.mockListDrives - - _, err := formatDrives(tt.args.ctx, tt.drivesClient, tt.drives, tt.force) - if (err != nil) != tt.wantErr { - t.Errorf("getNamespaceCreated() error = %v, wantErr %v", err, tt.wantErr) - } - }) - } -} diff --git a/operatorapi/doc.go b/operatorapi/doc.go deleted file mode 100644 index 1119bcc81..000000000 --- a/operatorapi/doc.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -// Package operatorapi MinIO Console Server -// -// Schemes: -// http -// ws -// Host: localhost -// BasePath: /api/v1 -// Version: 0.1.0 -// -// Consumes: -// - application/json -// -// Produces: -// - application/json -// -// swagger:meta -package operatorapi diff --git a/operatorapi/embedded_spec.go b/operatorapi/embedded_spec.go deleted file mode 100644 index 7935c5fa4..000000000 --- a/operatorapi/embedded_spec.go +++ /dev/null @@ -1,11109 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operatorapi - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "encoding/json" -) - -var ( - // SwaggerJSON embedded version of the swagger document used at generation time - SwaggerJSON json.RawMessage - // FlatSwaggerJSON embedded flattened version of the swagger document used at generation time - FlatSwaggerJSON json.RawMessage -) - -func init() { - SwaggerJSON = json.RawMessage([]byte(`{ - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "schemes": [ - "http", - "ws" - ], - "swagger": "2.0", - "info": { - "title": "MinIO Console Server", - "version": "0.1.0" - }, - "basePath": "/api/v1", - "paths": { - "/check-version": { - "get": { - "security": [], - "tags": [ - "UserAPI" - ], - "summary": "Checks the current Operator version against the latest", - "operationId": "CheckMinIOVersion”", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/checkOperatorVersionResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/cluster/allocatable-resources": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get allocatable cpu and memory for given number of nodes", - "operationId": "GetAllocatableResources", - "parameters": [ - { - "minimum": 1, - "type": "integer", - "format": "int32", - "name": "num_nodes", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/allocatableResourcesResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/cluster/max-allocatable-memory": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get maximum allocatable memory for given number of nodes", - "operationId": "GetMaxAllocatableMem", - "parameters": [ - { - "minimum": 1, - "type": "integer", - "format": "int32", - "name": "num_nodes", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/maxAllocatableMemResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/directpv/drives": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get directpv drives list", - "operationId": "GetDirectPVDriveList", - "parameters": [ - { - "type": "string", - "name": "nodes", - "in": "query" - }, - { - "type": "string", - "name": "drives", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/getDirectPVDriveListResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/directpv/drives/format": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Format directpv drives from a list", - "operationId": "DirectPVFormatDrive", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/formatConfiguration" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/formatDirectPVDrivesResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/directpv/volumes": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get directpv volumes list", - "operationId": "GetDirectPVVolumeList", - "parameters": [ - { - "type": "string", - "name": "nodes", - "in": "query" - }, - { - "type": "string", - "name": "drives", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/getDirectPVVolumeListResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/get-parity/{nodes}/{disksPerNode}": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Gets parity by sending number of nodes \u0026 number of disks", - "operationId": "GetParity", - "parameters": [ - { - "minimum": 2, - "type": "integer", - "name": "nodes", - "in": "path", - "required": true - }, - { - "minimum": 1, - "type": "integer", - "name": "disksPerNode", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/parityResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/list-pvcs": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "List all PVCs from namespaces that the user has access to", - "operationId": "ListPVCs", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listPVCsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/login": { - "get": { - "security": [], - "tags": [ - "Auth" - ], - "summary": "Returns login strategy, form or sso.", - "operationId": "LoginDetail", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/loginDetails" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/login/oauth2/auth": { - "post": { - "security": [], - "tags": [ - "Auth" - ], - "summary": "Identity Provider oauth2 callback endpoint.", - "operationId": "LoginOauth2Auth", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/loginOauth2AuthRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful login." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/login/operator": { - "post": { - "security": [], - "tags": [ - "Auth" - ], - "summary": "Login to Operator Console.", - "operationId": "LoginOperator", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/loginOperatorRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful login." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/logout": { - "post": { - "tags": [ - "Auth" - ], - "summary": "Logout from Operator.", - "operationId": "Logout", - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/mp-integration": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Returns email registered for marketplace integration", - "operationId": "GetMPIntegration", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "isEmailSet": { - "type": "boolean" - } - } - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Set email to register for marketplace integration", - "operationId": "PostMPIntegration", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/mpIntegration" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespace": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Creates a new Namespace with given information", - "operationId": "CreateNamespace", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/namespace" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/resourcequotas/{resource-quota-name}": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Resource Quota", - "operationId": "GetResourceQuota", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "resource-quota-name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/resourceQuota" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "List Tenants by Namespace", - "operationId": "ListTenants", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "sort_by", - "in": "query" - }, - { - "type": "integer", - "format": "int32", - "name": "offset", - "in": "query" - }, - { - "type": "integer", - "format": "int32", - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listTenantsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Details", - "operationId": "TenantDetails", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tenant" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "put": { - "tags": [ - "OperatorAPI" - ], - "summary": "Update Tenant", - "operationId": "UpdateTenant", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/updateTenantRequest" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "delete": { - "tags": [ - "OperatorAPI" - ], - "summary": "Delete tenant and underlying pvcs", - "operationId": "DeleteTenant", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "schema": { - "$ref": "#/definitions/deleteTenantRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/certificates": { - "put": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Update Certificates", - "operationId": "TenantUpdateCertificate", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/tlsConfiguration" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/configuration": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Configuration", - "operationId": "TenantConfiguration", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tenantConfigurationResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "patch": { - "tags": [ - "OperatorAPI" - ], - "summary": "Update Tenant Configuration", - "operationId": "UpdateTenantConfiguration", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/updateTenantConfigurationRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/csr": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "List Tenant Certificate Signing Request", - "operationId": "ListTenantCertificateSigningRequest", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/csrElements" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/disable-logging": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Disable Tenant Logging", - "operationId": "DisableTenantLogging", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "boolean" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/domains": { - "put": { - "tags": [ - "OperatorAPI" - ], - "summary": "Update Domains for a Tenant", - "operationId": "UpdateTenantDomains", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/updateDomainsRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/enable-logging": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Enable Tenant Logging", - "operationId": "EnableTenantLogging", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "boolean" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/encryption": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Encryption Info", - "operationId": "TenantEncryptionInfo", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/encryptionConfigurationResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "put": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Update Encryption", - "operationId": "TenantUpdateEncryption", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/encryptionConfiguration" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "delete": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Delete Encryption", - "operationId": "TenantDeleteEncryption", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/events": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Events for given Tenant", - "operationId": "GetTenantEvents", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/eventListWrapper" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/identity-provider": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Identity Provider", - "operationId": "TenantIdentityProvider", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/idpConfiguration" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Update Tenant Identity Provider", - "operationId": "UpdateTenantIdentityProvider", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/idpConfiguration" - } - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/log": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Tenant Logs", - "operationId": "GetTenantLogs", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tenantLogs" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "put": { - "tags": [ - "OperatorAPI" - ], - "summary": "Set Tenant Logs", - "operationId": "SetTenantLogs", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/tenantLogs" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "boolean" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/monitoring": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Prometheus Monitoring config info For The Tenant", - "operationId": "GetTenantMonitoring", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tenantMonitoringInfo" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "put": { - "tags": [ - "OperatorAPI" - ], - "summary": "Set Prometheus monitoring fields for tenant", - "operationId": "SetTenantMonitoring", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/tenantMonitoringInfo" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/pods": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Pods For The Tenant", - "operationId": "GetTenantPods", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/tenantPod" - } - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/pods/{podName}": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Logs for Pod", - "operationId": "GetPodLogs", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "podName", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "string" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "delete": { - "tags": [ - "OperatorAPI" - ], - "summary": "Delete pod", - "operationId": "DeletePod", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "podName", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/pods/{podName}/describe": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Describe Pod", - "operationId": "DescribePod", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "podName", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/describePodWrapper" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/pods/{podName}/events": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Events for Pod", - "operationId": "GetPodEvents", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "podName", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/eventListWrapper" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/pools": { - "put": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Update Pools", - "operationId": "TenantUpdatePools", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/poolUpdateRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tenant" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Add Pool", - "operationId": "TenantAddPool", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/pool" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/pvc/{PVCName}": { - "delete": { - "tags": [ - "OperatorAPI" - ], - "summary": "Delete PVC", - "operationId": "DeletePVC", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "PVCName", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/pvcs": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "List all PVCs from given Tenant", - "operationId": "ListPVCsForTenant", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listPVCsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/pvcs/{PVCName}/describe": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Describe output for PVC", - "operationId": "GetPVCDescribe", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "PVCName", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/describePVCWrapper" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/pvcs/{PVCName}/events": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Events for PVC", - "operationId": "GetPVCEvents", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "PVCName", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/eventListWrapper" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/security": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Security", - "operationId": "TenantSecurity", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tenantSecurityResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Update Tenant Security", - "operationId": "UpdateTenantSecurity", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/updateTenantSecurityRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/set-administrators": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Set the consoleAdmin policy to the specified users and groups", - "operationId": "SetTenantAdministrators", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/setAdministratorsRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/usage": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Usage For The Tenant", - "operationId": "GetTenantUsage", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tenantUsage" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/yaml": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get the Tenant YAML", - "operationId": "GetTenantYAML", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tenantYAML" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "put": { - "tags": [ - "OperatorAPI" - ], - "summary": "Put the Tenant YAML", - "operationId": "PutTenantYAML", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/tenantYAML" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/nodes/labels": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "List node labels", - "operationId": "ListNodeLabels", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/nodeLabels" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/session": { - "get": { - "tags": [ - "Auth" - ], - "summary": "Endpoint to check if your session is still valid", - "operationId": "SessionCheck", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/operatorSessionResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/subnet/apikey": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Subnet api key", - "operationId": "OperatorSubnetApiKey", - "parameters": [ - { - "type": "string", - "name": "token", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/operatorSubnetAPIKey" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/subnet/apikey/info": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Subnet API key info", - "operationId": "OperatorSubnetAPIKeyInfo", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/operatorSubnetRegisterAPIKeyResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/subnet/apikey/register": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Register Operator with Subnet", - "operationId": "OperatorSubnetRegisterAPIKey", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/operatorSubnetAPIKey" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/operatorSubnetRegisterAPIKeyResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/subnet/login": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Login to subnet", - "operationId": "OperatorSubnetLogin", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/operatorSubnetLoginRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/operatorSubnetLoginResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/subnet/login/mfa": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Login to subnet using mfa", - "operationId": "OperatorSubnetLoginMFA", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/operatorSubnetLoginMFARequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/operatorSubnetLoginResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/subscription/info": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Subscription info", - "operationId": "SubscriptionInfo", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/license" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/subscription/namespaces/{namespace}/tenants/{tenant}/activate": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Activate a particular tenant using the existing subscription license", - "operationId": "SubscriptionActivate", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/subscription/refresh": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Refresh existing subscription license", - "operationId": "SubscriptionRefresh", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/license" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/subscription/validate": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Validates subscription license", - "operationId": "SubscriptionValidate", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/subscriptionValidateRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/license" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/tenants": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "List Tenant of All Namespaces", - "operationId": "ListAllTenants", - "parameters": [ - { - "type": "string", - "name": "sort_by", - "in": "query" - }, - { - "type": "integer", - "format": "int32", - "name": "offset", - "in": "query" - }, - { - "type": "integer", - "format": "int32", - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listTenantsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Create Tenant", - "operationId": "CreateTenant", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/createTenantRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/createTenantResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - } - }, - "definitions": { - "allocatableResourcesResponse": { - "type": "object", - "properties": { - "cpu_priority": { - "$ref": "#/definitions/nodeMaxAllocatableResources" - }, - "mem_priority": { - "$ref": "#/definitions/nodeMaxAllocatableResources" - }, - "min_allocatable_cpu": { - "type": "integer", - "format": "int64" - }, - "min_allocatable_mem": { - "type": "integer", - "format": "int64" - } - } - }, - "annotation": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - } - }, - "awsConfiguration": { - "type": "object", - "required": [ - "secretsmanager" - ], - "properties": { - "secretsmanager": { - "type": "object", - "required": [ - "endpoint", - "region", - "credentials" - ], - "properties": { - "credentials": { - "type": "object", - "required": [ - "accesskey", - "secretkey" - ], - "properties": { - "accesskey": { - "type": "string" - }, - "secretkey": { - "type": "string" - }, - "token": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - }, - "kmskey": { - "type": "string" - }, - "region": { - "type": "string" - } - } - } - } - }, - "azureConfiguration": { - "type": "object", - "required": [ - "keyvault" - ], - "properties": { - "keyvault": { - "type": "object", - "required": [ - "endpoint" - ], - "properties": { - "credentials": { - "type": "object", - "required": [ - "tenant_id", - "client_id", - "client_secret" - ], - "properties": { - "client_id": { - "type": "string" - }, - "client_secret": { - "type": "string" - }, - "tenant_id": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - } - } - } - } - }, - "certificateInfo": { - "type": "object", - "properties": { - "domains": { - "type": "array", - "items": { - "type": "string" - } - }, - "expiry": { - "type": "string" - }, - "name": { - "type": "string" - }, - "serialNumber": { - "type": "string" - } - } - }, - "checkOperatorVersionResponse": { - "type": "object", - "properties": { - "current_version": { - "type": "string" - }, - "latest_version": { - "type": "string" - } - } - }, - "condition": { - "type": "object", - "properties": { - "status": { - "type": "string" - }, - "type": { - "type": "string" - } - } - }, - "configMap": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "optional": { - "type": "boolean" - } - } - }, - "configureTenantRequest": { - "type": "object", - "properties": { - "prometheusEnabled": { - "type": "boolean" - } - } - }, - "container": { - "type": "object", - "properties": { - "args": { - "type": "array", - "items": { - "type": "string" - } - }, - "containerID": { - "type": "string" - }, - "environmentVariables": { - "type": "array", - "items": { - "$ref": "#/definitions/environmentVariable" - } - }, - "hostPorts": { - "type": "array", - "items": { - "type": "string" - } - }, - "image": { - "type": "string" - }, - "imageID": { - "type": "string" - }, - "lastState": { - "$ref": "#/definitions/state" - }, - "mounts": { - "type": "array", - "items": { - "$ref": "#/definitions/mount" - } - }, - "name": { - "type": "string" - }, - "ports": { - "type": "array", - "items": { - "type": "string" - } - }, - "ready": { - "type": "boolean" - }, - "restartCount": { - "type": "integer" - }, - "state": { - "$ref": "#/definitions/state" - } - } - }, - "createTenantRequest": { - "type": "object", - "required": [ - "name", - "namespace", - "pools" - ], - "properties": { - "access_key": { - "type": "string" - }, - "annotations": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "domains": { - "type": "object", - "$ref": "#/definitions/domainsConfiguration" - }, - "enable_console": { - "type": "boolean", - "default": true - }, - "enable_prometheus": { - "type": "boolean", - "default": false - }, - "enable_tls": { - "type": "boolean", - "default": true - }, - "encryption": { - "type": "object", - "$ref": "#/definitions/encryptionConfiguration" - }, - "environmentVariables": { - "type": "array", - "items": { - "$ref": "#/definitions/environmentVariable" - } - }, - "erasureCodingParity": { - "type": "integer" - }, - "expose_console": { - "type": "boolean" - }, - "expose_minio": { - "type": "boolean" - }, - "idp": { - "type": "object", - "$ref": "#/definitions/idpConfiguration" - }, - "image": { - "type": "string" - }, - "image_pull_secret": { - "type": "string" - }, - "image_registry": { - "$ref": "#/definitions/imageRegistry" - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "logSearchConfiguration": { - "$ref": "#/definitions/logSearchConfiguration" - }, - "mount_path": { - "type": "string" - }, - "name": { - "type": "string", - "pattern": "^[a-z0-9-]{3,63}$" - }, - "namespace": { - "type": "string" - }, - "pools": { - "type": "array", - "items": { - "$ref": "#/definitions/pool" - } - }, - "prometheusConfiguration": { - "$ref": "#/definitions/prometheusConfiguration" - }, - "secret_key": { - "type": "string" - }, - "tls": { - "type": "object", - "$ref": "#/definitions/tlsConfiguration" - } - } - }, - "createTenantResponse": { - "type": "object", - "properties": { - "console": { - "type": "array", - "items": { - "$ref": "#/definitions/tenantResponseItem" - } - }, - "externalIDP": { - "type": "boolean" - } - } - }, - "csrElement": { - "type": "object", - "properties": { - "annotations": { - "type": "array", - "items": { - "$ref": "#/definitions/annotation" - } - }, - "deletion_grace_period_seconds": { - "type": "integer", - "format": "int64" - }, - "generate_name": { - "type": "string" - }, - "generation": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "resource_version": { - "type": "string" - }, - "status": { - "type": "string" - } - } - }, - "csrElements": { - "type": "object", - "properties": { - "csrElement": { - "type": "array", - "items": { - "$ref": "#/definitions/csrElement" - } - } - } - }, - "deleteTenantRequest": { - "type": "object", - "properties": { - "delete_pvcs": { - "type": "boolean" - } - } - }, - "describePVCWrapper": { - "type": "object", - "properties": { - "accessModes": { - "type": "array", - "items": { - "type": "string" - } - }, - "annotations": { - "type": "array", - "items": { - "$ref": "#/definitions/annotation" - } - }, - "capacity": { - "type": "string" - }, - "finalizers": { - "type": "array", - "items": { - "type": "string" - } - }, - "labels": { - "type": "array", - "items": { - "$ref": "#/definitions/label" - } - }, - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "status": { - "type": "string" - }, - "storageClass": { - "type": "string" - }, - "volume": { - "type": "string" - }, - "volumeMode": { - "type": "string" - } - } - }, - "describePodWrapper": { - "type": "object", - "properties": { - "annotations": { - "type": "array", - "items": { - "$ref": "#/definitions/annotation" - } - }, - "conditions": { - "type": "array", - "items": { - "$ref": "#/definitions/condition" - } - }, - "containers": { - "type": "array", - "items": { - "$ref": "#/definitions/container" - } - }, - "controllerRef": { - "type": "string" - }, - "deletionGracePeriodSeconds": { - "type": "integer" - }, - "deletionTimestamp": { - "type": "string" - }, - "labels": { - "type": "array", - "items": { - "$ref": "#/definitions/label" - } - }, - "message": { - "type": "string" - }, - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "nodeName": { - "type": "string" - }, - "nodeSelector": { - "type": "array", - "items": { - "$ref": "#/definitions/nodeSelector" - } - }, - "phase": { - "type": "string" - }, - "podIP": { - "type": "string" - }, - "priority": { - "type": "integer" - }, - "priorityClassName": { - "type": "string" - }, - "qosClass": { - "type": "string" - }, - "reason": { - "type": "string" - }, - "startTime": { - "type": "string" - }, - "tolerations": { - "type": "array", - "items": { - "$ref": "#/definitions/toleration" - } - }, - "volumes": { - "type": "array", - "items": { - "$ref": "#/definitions/volume" - } - } - } - }, - "directPVDriveInfo": { - "type": "object", - "properties": { - "allocated": { - "type": "number", - "format": "int64" - }, - "capacity": { - "type": "number", - "format": "int64" - }, - "drive": { - "type": "string" - }, - "message": { - "type": "string" - }, - "node": { - "type": "string" - }, - "status": { - "type": "string" - }, - "volumes": { - "type": "number", - "format": "int64" - } - } - }, - "directPVVolumeInfo": { - "type": "object", - "properties": { - "capacity": { - "type": "number", - "format": "int64" - }, - "drive": { - "type": "string" - }, - "node": { - "type": "string" - }, - "volume": { - "type": "string" - } - } - }, - "domainsConfiguration": { - "type": "object", - "properties": { - "console": { - "type": "string" - }, - "minio": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "encryptionConfiguration": { - "allOf": [ - { - "$ref": "#/definitions/metadataFields" - }, - { - "type": "object", - "properties": { - "aws": { - "type": "object", - "$ref": "#/definitions/awsConfiguration" - }, - "azure": { - "type": "object", - "$ref": "#/definitions/azureConfiguration" - }, - "gcp": { - "type": "object", - "$ref": "#/definitions/gcpConfiguration" - }, - "gemalto": { - "type": "object", - "$ref": "#/definitions/gemaltoConfiguration" - }, - "image": { - "type": "string" - }, - "kms_mtls": { - "type": "object", - "properties": { - "ca": { - "type": "string" - }, - "crt": { - "type": "string" - }, - "key": { - "type": "string" - } - } - }, - "minio_mtls": { - "type": "object", - "$ref": "#/definitions/keyPairConfiguration" - }, - "raw": { - "type": "string" - }, - "replicas": { - "type": "string" - }, - "secretsToBeDeleted": { - "type": "array", - "items": { - "type": "string" - } - }, - "securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - }, - "server_tls": { - "type": "object", - "$ref": "#/definitions/keyPairConfiguration" - }, - "vault": { - "type": "object", - "$ref": "#/definitions/vaultConfiguration" - } - } - } - ] - }, - "encryptionConfigurationResponse": { - "allOf": [ - { - "$ref": "#/definitions/metadataFields" - }, - { - "type": "object", - "properties": { - "aws": { - "type": "object", - "$ref": "#/definitions/awsConfiguration" - }, - "azure": { - "type": "object", - "$ref": "#/definitions/azureConfiguration" - }, - "gcp": { - "type": "object", - "$ref": "#/definitions/gcpConfiguration" - }, - "gemalto": { - "type": "object", - "$ref": "#/definitions/gemaltoConfigurationResponse" - }, - "image": { - "type": "string" - }, - "kms_mtls": { - "type": "object", - "properties": { - "ca": { - "type": "object", - "$ref": "#/definitions/certificateInfo" - }, - "crt": { - "type": "object", - "$ref": "#/definitions/certificateInfo" - } - } - }, - "minio_mtls": { - "type": "object", - "$ref": "#/definitions/certificateInfo" - }, - "raw": { - "type": "string" - }, - "replicas": { - "type": "string" - }, - "securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - }, - "server_tls": { - "type": "object", - "$ref": "#/definitions/certificateInfo" - }, - "vault": { - "type": "object", - "$ref": "#/definitions/vaultConfigurationResponse" - } - } - } - ] - }, - "environmentVariable": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - } - }, - "error": { - "type": "object", - "required": [ - "message", - "detailedMessage" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "detailedMessage": { - "type": "string" - }, - "message": { - "type": "string" - } - } - }, - "eventListElement": { - "type": "object", - "properties": { - "event_type": { - "type": "string" - }, - "last_seen": { - "type": "integer", - "format": "int64" - }, - "message": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "object": { - "type": "string" - }, - "reason": { - "type": "string" - } - } - }, - "eventListWrapper": { - "type": "array", - "items": { - "$ref": "#/definitions/eventListElement" - } - }, - "formatConfiguration": { - "type": "object", - "required": [ - "drives", - "force" - ], - "properties": { - "drives": { - "type": "array", - "minLength": 1, - "items": { - "type": "string" - } - }, - "force": { - "type": "boolean" - } - } - }, - "formatDirectPVDrivesResponse": { - "type": "object", - "properties": { - "formatIssuesList": { - "type": "array", - "items": { - "$ref": "#/definitions/pvFormatErrorResponse" - } - } - } - }, - "gcpConfiguration": { - "type": "object", - "required": [ - "secretmanager" - ], - "properties": { - "secretmanager": { - "type": "object", - "required": [ - "project_id" - ], - "properties": { - "credentials": { - "type": "object", - "properties": { - "client_email": { - "type": "string" - }, - "client_id": { - "type": "string" - }, - "private_key": { - "type": "string" - }, - "private_key_id": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - }, - "project_id": { - "type": "string" - } - } - } - } - }, - "gemaltoConfiguration": { - "type": "object", - "required": [ - "keysecure" - ], - "properties": { - "keysecure": { - "type": "object", - "required": [ - "endpoint", - "credentials" - ], - "properties": { - "credentials": { - "type": "object", - "required": [ - "token", - "domain" - ], - "properties": { - "domain": { - "type": "string" - }, - "retry": { - "type": "integer", - "format": "int64" - }, - "token": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - } - } - } - } - }, - "gemaltoConfigurationResponse": { - "type": "object", - "required": [ - "keysecure" - ], - "properties": { - "keysecure": { - "type": "object", - "required": [ - "endpoint", - "credentials" - ], - "properties": { - "credentials": { - "type": "object", - "required": [ - "token", - "domain" - ], - "properties": { - "domain": { - "type": "string" - }, - "retry": { - "type": "integer", - "format": "int64" - }, - "token": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - } - } - } - } - }, - "getDirectPVDriveListResponse": { - "type": "object", - "properties": { - "drives": { - "type": "array", - "items": { - "$ref": "#/definitions/directPVDriveInfo" - } - } - } - }, - "getDirectPVVolumeListResponse": { - "type": "object", - "properties": { - "volumes": { - "type": "array", - "items": { - "$ref": "#/definitions/directPVVolumeInfo" - } - } - } - }, - "idpConfiguration": { - "type": "object", - "properties": { - "active_directory": { - "type": "object", - "required": [ - "url", - "lookup_bind_dn" - ], - "properties": { - "group_search_base_dn": { - "type": "string" - }, - "group_search_filter": { - "type": "string" - }, - "lookup_bind_dn": { - "type": "string" - }, - "lookup_bind_password": { - "type": "string" - }, - "server_insecure": { - "type": "boolean" - }, - "server_start_tls": { - "type": "boolean" - }, - "skip_tls_verification": { - "type": "boolean" - }, - "url": { - "type": "string" - }, - "user_dn_search_base_dn": { - "type": "string" - }, - "user_dn_search_filter": { - "type": "string" - }, - "user_dns": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "keys": { - "type": "array", - "items": { - "type": "object", - "required": [ - "access_key", - "secret_key" - ], - "properties": { - "access_key": { - "type": "string" - }, - "secret_key": { - "type": "string" - } - } - } - }, - "oidc": { - "type": "object", - "required": [ - "configuration_url", - "client_id", - "secret_id", - "claim_name" - ], - "properties": { - "callback_url": { - "type": "string" - }, - "claim_name": { - "type": "string" - }, - "client_id": { - "type": "string" - }, - "configuration_url": { - "type": "string" - }, - "scopes": { - "type": "string" - }, - "secret_id": { - "type": "string" - } - } - } - } - }, - "imageRegistry": { - "type": "object", - "required": [ - "registry", - "username", - "password" - ], - "properties": { - "password": { - "type": "string" - }, - "registry": { - "type": "string" - }, - "username": { - "type": "string" - } - } - }, - "keyPairConfiguration": { - "type": "object", - "required": [ - "crt", - "key" - ], - "properties": { - "crt": { - "type": "string" - }, - "key": { - "type": "string" - } - } - }, - "label": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - } - }, - "license": { - "type": "object", - "properties": { - "account_id": { - "type": "integer" - }, - "email": { - "type": "string" - }, - "expires_at": { - "type": "string" - }, - "organization": { - "type": "string" - }, - "plan": { - "type": "string" - }, - "storage_capacity": { - "type": "integer" - } - } - }, - "listPVCsResponse": { - "type": "object", - "properties": { - "pvcs": { - "type": "array", - "items": { - "$ref": "#/definitions/pvcsListResponse" - } - } - } - }, - "listTenantsResponse": { - "type": "object", - "properties": { - "tenants": { - "type": "array", - "title": "list of resulting tenants", - "items": { - "$ref": "#/definitions/tenantList" - } - }, - "total": { - "type": "integer", - "format": "int64", - "title": "number of tenants accessible to tenant user" - } - } - }, - "logSearchConfiguration": { - "type": "object", - "properties": { - "image": { - "type": "string" - }, - "postgres_image": { - "type": "string" - }, - "postgres_init_image": { - "type": "string" - }, - "postgres_securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - }, - "securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - }, - "storageClass": { - "type": "string", - "default": "" - }, - "storageSize": { - "type": "number", - "default": 5 - } - } - }, - "loginDetails": { - "type": "object", - "properties": { - "isDirectPV": { - "type": "boolean" - }, - "isK8S": { - "type": "boolean" - }, - "loginStrategy": { - "type": "string", - "enum": [ - "form", - "redirect", - "service-account", - "redirect-service-account" - ] - }, - "redirectRules": { - "type": "array", - "items": { - "$ref": "#/definitions/redirectRule" - } - } - } - }, - "loginOauth2AuthRequest": { - "type": "object", - "required": [ - "state", - "code" - ], - "properties": { - "code": { - "type": "string" - }, - "state": { - "type": "string" - } - } - }, - "loginOperatorRequest": { - "type": "object", - "required": [ - "jwt" - ], - "properties": { - "jwt": { - "type": "string" - } - } - }, - "loginRequest": { - "type": "object", - "properties": { - "accessKey": { - "type": "string" - }, - "features": { - "type": "object", - "properties": { - "hide_menu": { - "type": "boolean" - } - } - }, - "secretKey": { - "type": "string" - }, - "sts": { - "type": "string" - } - } - }, - "maxAllocatableMemResponse": { - "type": "object", - "properties": { - "max_memory": { - "type": "integer", - "format": "int64" - } - } - }, - "metadataFields": { - "type": "object", - "properties": { - "annotations": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "node_selector": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, - "mount": { - "type": "object", - "properties": { - "mountPath": { - "type": "string" - }, - "name": { - "type": "string" - }, - "readOnly": { - "type": "boolean" - }, - "subPath": { - "type": "string" - } - } - }, - "mpIntegration": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "isInEU": { - "type": "boolean" - } - } - }, - "namespace": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - } - } - }, - "nodeLabels": { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "nodeMaxAllocatableResources": { - "type": "object", - "properties": { - "max_allocatable_cpu": { - "type": "integer", - "format": "int64" - }, - "max_allocatable_mem": { - "type": "integer", - "format": "int64" - } - } - }, - "nodeSelector": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - } - }, - "nodeSelectorTerm": { - "description": "A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.", - "type": "object", - "properties": { - "matchExpressions": { - "description": "A list of node selector requirements by node's labels.", - "type": "array", - "items": { - "description": "A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", - "type": "object", - "required": [ - "key", - "operator" - ], - "properties": { - "key": { - "description": "The label key that the selector applies to.", - "type": "string" - }, - "operator": { - "description": "Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.", - "type": "string" - }, - "values": { - "description": "An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.", - "type": "array", - "items": { - "type": "string" - } - } - } - } - }, - "matchFields": { - "description": "A list of node selector requirements by node's fields.", - "type": "array", - "items": { - "description": "A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", - "type": "object", - "required": [ - "key", - "operator" - ], - "properties": { - "key": { - "description": "The label key that the selector applies to.", - "type": "string" - }, - "operator": { - "description": "Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.", - "type": "string" - }, - "values": { - "description": "An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.", - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - } - }, - "operatorSessionResponse": { - "type": "object", - "properties": { - "directPV": { - "type": "boolean" - }, - "features": { - "type": "array", - "items": { - "type": "string" - } - }, - "operator": { - "type": "boolean" - }, - "permissions": { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "status": { - "type": "string", - "enum": [ - "ok" - ] - } - } - }, - "operatorSubnetAPIKey": { - "type": "object", - "properties": { - "apiKey": { - "type": "string" - } - } - }, - "operatorSubnetLoginMFARequest": { - "type": "object", - "required": [ - "username", - "otp", - "mfa_token" - ], - "properties": { - "mfa_token": { - "type": "string" - }, - "otp": { - "type": "string" - }, - "username": { - "type": "string" - } - } - }, - "operatorSubnetLoginRequest": { - "type": "object", - "properties": { - "password": { - "type": "string" - }, - "username": { - "type": "string" - } - } - }, - "operatorSubnetLoginResponse": { - "type": "object", - "properties": { - "access_token": { - "type": "string" - }, - "mfa_token": { - "type": "string" - } - } - }, - "operatorSubnetRegisterAPIKeyResponse": { - "type": "object", - "properties": { - "registered": { - "type": "boolean" - } - } - }, - "parityResponse": { - "type": "array", - "items": { - "type": "string" - } - }, - "podAffinityTerm": { - "description": "Required. A pod affinity term, associated with the corresponding weight.", - "type": "object", - "required": [ - "topologyKey" - ], - "properties": { - "labelSelector": { - "description": "A label query over a set of resources, in this case pods.", - "type": "object", - "properties": { - "matchExpressions": { - "description": "matchExpressions is a list of label selector requirements. The requirements are ANDed.", - "type": "array", - "items": { - "description": "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", - "type": "object", - "required": [ - "key", - "operator" - ], - "properties": { - "key": { - "description": "key is the label key that the selector applies to.", - "type": "string" - }, - "operator": { - "description": "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.", - "type": "string" - }, - "values": { - "description": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.", - "type": "array", - "items": { - "type": "string" - } - } - } - } - }, - "matchLabels": { - "description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.", - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, - "namespaces": { - "description": "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"", - "type": "array", - "items": { - "type": "string" - } - }, - "topologyKey": { - "description": "This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.", - "type": "string" - } - } - }, - "pool": { - "type": "object", - "required": [ - "servers", - "volumes_per_server", - "volume_configuration" - ], - "properties": { - "affinity": { - "$ref": "#/definitions/poolAffinity" - }, - "name": { - "type": "string" - }, - "node_selector": { - "description": "NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/", - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "resources": { - "$ref": "#/definitions/poolResources" - }, - "runtimeClassName": { - "type": "string" - }, - "securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - }, - "servers": { - "type": "integer" - }, - "tolerations": { - "$ref": "#/definitions/poolTolerations" - }, - "volume_configuration": { - "type": "object", - "required": [ - "size" - ], - "properties": { - "annotations": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "size": { - "type": "integer" - }, - "storage_class_name": { - "type": "string" - } - } - }, - "volumes_per_server": { - "type": "integer", - "format": "int32" - } - } - }, - "poolAffinity": { - "description": "If specified, affinity will define the pod's scheduling constraints", - "type": "object", - "properties": { - "nodeAffinity": { - "description": "Describes node affinity scheduling rules for the pod.", - "type": "object", - "properties": { - "preferredDuringSchedulingIgnoredDuringExecution": { - "description": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.", - "type": "array", - "items": { - "description": "An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).", - "type": "object", - "required": [ - "preference", - "weight" - ], - "properties": { - "preference": { - "description": "A node selector term, associated with the corresponding weight.", - "type": "object", - "$ref": "#/definitions/nodeSelectorTerm" - }, - "weight": { - "description": "Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.", - "type": "integer", - "format": "int32" - } - } - } - }, - "requiredDuringSchedulingIgnoredDuringExecution": { - "description": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node.", - "type": "object", - "required": [ - "nodeSelectorTerms" - ], - "properties": { - "nodeSelectorTerms": { - "description": "Required. A list of node selector terms. The terms are ORed.", - "type": "array", - "items": { - "$ref": "#/definitions/nodeSelectorTerm" - } - } - } - } - } - }, - "podAffinity": { - "description": "Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, pool, etc. as some other pod(s)).", - "type": "object", - "properties": { - "preferredDuringSchedulingIgnoredDuringExecution": { - "description": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.", - "type": "array", - "items": { - "description": "The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)", - "type": "object", - "required": [ - "podAffinityTerm", - "weight" - ], - "properties": { - "podAffinityTerm": { - "$ref": "#/definitions/podAffinityTerm" - }, - "weight": { - "description": "weight associated with matching the corresponding podAffinityTerm, in the range 1-100.", - "type": "integer", - "format": "int32" - } - } - } - }, - "requiredDuringSchedulingIgnoredDuringExecution": { - "description": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.", - "type": "array", - "items": { - "$ref": "#/definitions/podAffinityTerm" - } - } - } - }, - "podAntiAffinity": { - "description": "Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, pool, etc. as some other pod(s)).", - "type": "object", - "properties": { - "preferredDuringSchedulingIgnoredDuringExecution": { - "description": "The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.", - "type": "array", - "items": { - "description": "The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)", - "type": "object", - "required": [ - "podAffinityTerm", - "weight" - ], - "properties": { - "podAffinityTerm": { - "$ref": "#/definitions/podAffinityTerm" - }, - "weight": { - "description": "weight associated with matching the corresponding podAffinityTerm, in the range 1-100.", - "type": "integer", - "format": "int32" - } - } - } - }, - "requiredDuringSchedulingIgnoredDuringExecution": { - "description": "If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.", - "type": "array", - "items": { - "$ref": "#/definitions/podAffinityTerm" - } - } - } - } - } - }, - "poolResources": { - "description": "If provided, use these requests and limit for cpu/memory resource allocation", - "type": "object", - "properties": { - "limits": { - "description": "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/", - "type": "object", - "additionalProperties": { - "type": "integer", - "format": "int64" - } - }, - "requests": { - "description": "Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/", - "type": "object", - "additionalProperties": { - "type": "integer", - "format": "int64" - } - } - } - }, - "poolTolerationSeconds": { - "description": "TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.", - "type": "object", - "required": [ - "seconds" - ], - "properties": { - "seconds": { - "type": "integer", - "format": "int64" - } - } - }, - "poolTolerations": { - "description": "Tolerations allows users to set entries like effect, key, operator, value.", - "type": "array", - "items": { - "description": "The pod this Toleration is attached to tolerates any taint that matches the triple \u003ckey,value,effect\u003e using the matching operator \u003coperator\u003e.", - "type": "object", - "properties": { - "effect": { - "description": "Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.", - "type": "string" - }, - "key": { - "description": "Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.", - "type": "string" - }, - "operator": { - "description": "Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.", - "type": "string" - }, - "tolerationSeconds": { - "$ref": "#/definitions/poolTolerationSeconds" - }, - "value": { - "description": "Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.", - "type": "string" - } - } - } - }, - "poolUpdateRequest": { - "type": "object", - "required": [ - "pools" - ], - "properties": { - "pools": { - "type": "array", - "items": { - "$ref": "#/definitions/pool" - } - } - } - }, - "projectedVolume": { - "type": "object", - "properties": { - "sources": { - "type": "array", - "items": { - "$ref": "#/definitions/projectedVolumeSource" - } - } - } - }, - "projectedVolumeSource": { - "type": "object", - "properties": { - "configMap": { - "$ref": "#/definitions/configMap" - }, - "downwardApi": { - "type": "boolean" - }, - "secret": { - "$ref": "#/definitions/secret" - }, - "serviceAccountToken": { - "$ref": "#/definitions/serviceAccountToken" - } - } - }, - "prometheusConfiguration": { - "type": "object", - "properties": { - "image": { - "type": "string" - }, - "init_image": { - "type": "string" - }, - "securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - }, - "sidecar_image": { - "type": "string" - }, - "storageClass": { - "type": "string", - "default": "" - }, - "storageSize": { - "type": "number", - "default": 5 - } - } - }, - "pvFormatErrorResponse": { - "type": "object", - "properties": { - "drive": { - "type": "string" - }, - "error": { - "type": "string" - }, - "node": { - "type": "string" - } - } - }, - "pvc": { - "type": "object", - "properties": { - "claimName": { - "type": "string" - }, - "readOnly": { - "type": "boolean" - } - } - }, - "pvcsListResponse": { - "type": "object", - "properties": { - "age": { - "type": "string" - }, - "capacity": { - "type": "string" - }, - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "status": { - "type": "string" - }, - "storageClass": { - "type": "string" - }, - "tenant": { - "type": "string" - }, - "volume": { - "type": "string" - } - } - }, - "redirectRule": { - "type": "object", - "properties": { - "displayName": { - "type": "string" - }, - "redirect": { - "type": "string" - } - } - }, - "resourceQuota": { - "type": "object", - "properties": { - "elements": { - "type": "array", - "items": { - "$ref": "#/definitions/resourceQuotaElement" - } - }, - "name": { - "type": "string" - } - } - }, - "resourceQuotaElement": { - "type": "object", - "properties": { - "hard": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "used": { - "type": "integer", - "format": "int64" - } - } - }, - "secret": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "optional": { - "type": "boolean" - } - } - }, - "securityContext": { - "type": "object", - "required": [ - "runAsUser", - "runAsGroup", - "runAsNonRoot" - ], - "properties": { - "fsGroup": { - "type": "string" - }, - "fsGroupChangePolicy": { - "type": "string" - }, - "runAsGroup": { - "type": "string" - }, - "runAsNonRoot": { - "type": "boolean" - }, - "runAsUser": { - "type": "string" - } - } - }, - "serviceAccountToken": { - "type": "object", - "properties": { - "expirationSeconds": { - "type": "integer" - } - } - }, - "setAdministratorsRequest": { - "type": "object", - "properties": { - "group_dns": { - "type": "array", - "items": { - "type": "string" - } - }, - "user_dns": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "state": { - "type": "object", - "properties": { - "exitCode": { - "type": "integer" - }, - "finished": { - "type": "string" - }, - "message": { - "type": "string" - }, - "reason": { - "type": "string" - }, - "signal": { - "type": "integer" - }, - "started": { - "type": "string" - }, - "state": { - "type": "string" - } - } - }, - "subscriptionValidateRequest": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "license": { - "type": "string" - }, - "password": { - "type": "string" - } - } - }, - "tenant": { - "type": "object", - "properties": { - "creation_date": { - "type": "string" - }, - "currentState": { - "type": "string" - }, - "deletion_date": { - "type": "string" - }, - "domains": { - "$ref": "#/definitions/domainsConfiguration" - }, - "enable_prometheus": { - "type": "boolean" - }, - "encryptionEnabled": { - "type": "boolean" - }, - "endpoints": { - "type": "object", - "properties": { - "console": { - "type": "string" - }, - "minio": { - "type": "string" - } - } - }, - "idpAdEnabled": { - "type": "boolean" - }, - "idpOidcEnabled": { - "type": "boolean" - }, - "image": { - "type": "string" - }, - "logEnabled": { - "type": "boolean" - }, - "minioTLS": { - "type": "boolean" - }, - "monitoringEnabled": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "pools": { - "type": "array", - "items": { - "$ref": "#/definitions/pool" - } - }, - "status": { - "$ref": "#/definitions/tenantStatus" - }, - "subnet_license": { - "$ref": "#/definitions/license" - }, - "total_size": { - "type": "integer", - "format": "int64" - } - } - }, - "tenantConfigurationResponse": { - "type": "object", - "properties": { - "environmentVariables": { - "type": "array", - "items": { - "$ref": "#/definitions/environmentVariable" - } - } - } - }, - "tenantList": { - "type": "object", - "properties": { - "capacity": { - "type": "integer", - "format": "int64" - }, - "capacity_raw": { - "type": "integer", - "format": "int64" - }, - "capacity_raw_usage": { - "type": "integer", - "format": "int64" - }, - "capacity_usage": { - "type": "integer", - "format": "int64" - }, - "creation_date": { - "type": "string" - }, - "currentState": { - "type": "string" - }, - "deletion_date": { - "type": "string" - }, - "domains": { - "type": "object", - "$ref": "#/definitions/domainsConfiguration" - }, - "health_status": { - "type": "string" - }, - "instance_count": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "pool_count": { - "type": "integer" - }, - "tiers": { - "type": "array", - "items": { - "$ref": "#/definitions/tenantTierElement" - } - }, - "total_size": { - "type": "integer" - }, - "volume_count": { - "type": "integer" - } - } - }, - "tenantLogs": { - "type": "object", - "properties": { - "annotations": { - "type": "array", - "items": { - "$ref": "#/definitions/annotation" - } - }, - "dbAnnotations": { - "type": "array", - "items": { - "$ref": "#/definitions/annotation" - } - }, - "dbImage": { - "type": "string" - }, - "dbInitImage": { - "type": "string" - }, - "dbLabels": { - "type": "array", - "items": { - "$ref": "#/definitions/label" - } - }, - "dbNodeSelector": { - "type": "array", - "items": { - "$ref": "#/definitions/nodeSelector" - } - }, - "dbSecurityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - }, - "dbServiceAccountName": { - "type": "string" - }, - "disabled": { - "type": "boolean" - }, - "diskCapacityGB": { - "type": "string" - }, - "image": { - "type": "string" - }, - "labels": { - "type": "array", - "items": { - "$ref": "#/definitions/label" - } - }, - "logCPURequest": { - "type": "string" - }, - "logDBCPURequest": { - "type": "string" - }, - "logDBMemRequest": { - "type": "string" - }, - "logMemRequest": { - "type": "string" - }, - "nodeSelector": { - "type": "array", - "items": { - "$ref": "#/definitions/nodeSelector" - } - }, - "securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - }, - "serviceAccountName": { - "type": "string" - } - } - }, - "tenantMonitoringInfo": { - "type": "object", - "properties": { - "annotations": { - "type": "array", - "items": { - "$ref": "#/definitions/annotation" - } - }, - "diskCapacityGB": { - "type": "string" - }, - "image": { - "type": "string" - }, - "initImage": { - "type": "string" - }, - "labels": { - "type": "array", - "items": { - "$ref": "#/definitions/label" - } - }, - "monitoringCPURequest": { - "type": "string" - }, - "monitoringMemRequest": { - "type": "string" - }, - "nodeSelector": { - "type": "array", - "items": { - "$ref": "#/definitions/nodeSelector" - } - }, - "prometheusEnabled": { - "type": "boolean" - }, - "securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - }, - "serviceAccountName": { - "type": "string" - }, - "sidecarImage": { - "type": "string" - }, - "storageClassName": { - "type": "string" - }, - "toggle": { - "type": "boolean" - } - } - }, - "tenantPod": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "node": { - "type": "string" - }, - "podIP": { - "type": "string" - }, - "restarts": { - "type": "integer" - }, - "status": { - "type": "string" - }, - "timeCreated": { - "type": "integer" - } - } - }, - "tenantResponseItem": { - "type": "object", - "properties": { - "access_key": { - "type": "string" - }, - "secret_key": { - "type": "string" - }, - "url": { - "type": "string" - } - } - }, - "tenantSecurityResponse": { - "type": "object", - "properties": { - "autoCert": { - "type": "boolean" - }, - "customCertificates": { - "type": "object", - "properties": { - "client": { - "type": "array", - "items": { - "$ref": "#/definitions/certificateInfo" - } - }, - "minio": { - "type": "array", - "items": { - "$ref": "#/definitions/certificateInfo" - } - }, - "minioCAs": { - "type": "array", - "items": { - "$ref": "#/definitions/certificateInfo" - } - } - } - }, - "securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - } - } - }, - "tenantStatus": { - "type": "object", - "properties": { - "drives_healing": { - "type": "integer", - "format": "int32" - }, - "drives_offline": { - "type": "integer", - "format": "int32" - }, - "drives_online": { - "type": "integer", - "format": "int32" - }, - "health_status": { - "type": "string" - }, - "usage": { - "type": "object", - "properties": { - "capacity": { - "type": "integer", - "format": "int64" - }, - "capacity_usage": { - "type": "integer", - "format": "int64" - }, - "raw": { - "type": "integer", - "format": "int64" - }, - "raw_usage": { - "type": "integer", - "format": "int64" - } - } - }, - "write_quorum": { - "type": "integer", - "format": "int32" - } - } - }, - "tenantTierElement": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "size": { - "type": "integer", - "format": "int64" - }, - "type": { - "type": "string" - } - } - }, - "tenantUsage": { - "type": "object", - "properties": { - "disk_used": { - "type": "integer", - "format": "int64" - }, - "used": { - "type": "integer", - "format": "int64" - } - } - }, - "tenantYAML": { - "type": "object", - "properties": { - "yaml": { - "type": "string" - } - } - }, - "tlsConfiguration": { - "type": "object", - "properties": { - "minioCAsCertificates": { - "type": "array", - "items": { - "type": "string" - } - }, - "minioClientCertificates": { - "type": "array", - "items": { - "$ref": "#/definitions/keyPairConfiguration" - } - }, - "minioServerCertificates": { - "type": "array", - "items": { - "$ref": "#/definitions/keyPairConfiguration" - } - } - } - }, - "toleration": { - "type": "object", - "properties": { - "effect": { - "type": "string" - }, - "key": { - "type": "string" - }, - "operator": { - "type": "string" - }, - "tolerationSeconds": { - "type": "integer" - }, - "value": { - "type": "string" - } - } - }, - "updateDomainsRequest": { - "type": "object", - "properties": { - "domains": { - "$ref": "#/definitions/domainsConfiguration" - } - } - }, - "updateTenantConfigurationRequest": { - "type": "object", - "properties": { - "environmentVariables": { - "type": "array", - "items": { - "$ref": "#/definitions/environmentVariable" - } - }, - "keysToBeDeleted": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "updateTenantRequest": { - "type": "object", - "properties": { - "enable_prometheus": { - "type": "boolean" - }, - "image": { - "type": "string", - "pattern": "^((.*?)/(.*?):(.+))$" - }, - "image_pull_secret": { - "type": "string" - }, - "image_registry": { - "$ref": "#/definitions/imageRegistry" - } - } - }, - "updateTenantSecurityRequest": { - "type": "object", - "properties": { - "autoCert": { - "type": "boolean" - }, - "customCertificates": { - "type": "object", - "properties": { - "minioCAsCertificates": { - "type": "array", - "items": { - "type": "string" - } - }, - "minioClientCertificates": { - "type": "array", - "items": { - "$ref": "#/definitions/keyPairConfiguration" - } - }, - "minioServerCertificates": { - "type": "array", - "items": { - "$ref": "#/definitions/keyPairConfiguration" - } - }, - "secretsToBeDeleted": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - } - } - }, - "vaultConfiguration": { - "type": "object", - "required": [ - "endpoint", - "approle" - ], - "properties": { - "approle": { - "type": "object", - "required": [ - "id", - "secret" - ], - "properties": { - "engine": { - "type": "string" - }, - "id": { - "type": "string" - }, - "retry": { - "type": "integer", - "format": "int64" - }, - "secret": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - }, - "engine": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "status": { - "type": "object", - "properties": { - "ping": { - "type": "integer", - "format": "int64" - } - } - } - } - }, - "vaultConfigurationResponse": { - "type": "object", - "required": [ - "endpoint", - "approle" - ], - "properties": { - "approle": { - "type": "object", - "required": [ - "id", - "secret" - ], - "properties": { - "engine": { - "type": "string" - }, - "id": { - "type": "string" - }, - "retry": { - "type": "integer", - "format": "int64" - }, - "secret": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - }, - "engine": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "status": { - "type": "object", - "properties": { - "ping": { - "type": "integer", - "format": "int64" - } - } - } - } - }, - "volume": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "projected": { - "$ref": "#/definitions/projectedVolume" - }, - "pvc": { - "$ref": "#/definitions/pvc" - } - } - } - }, - "securityDefinitions": { - "key": { - "type": "oauth2", - "flow": "accessCode", - "authorizationUrl": "http://min.io", - "tokenUrl": "http://min.io" - } - }, - "security": [ - { - "key": [] - } - ] -}`)) - FlatSwaggerJSON = json.RawMessage([]byte(`{ - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "schemes": [ - "http", - "ws" - ], - "swagger": "2.0", - "info": { - "title": "MinIO Console Server", - "version": "0.1.0" - }, - "basePath": "/api/v1", - "paths": { - "/check-version": { - "get": { - "security": [], - "tags": [ - "UserAPI" - ], - "summary": "Checks the current Operator version against the latest", - "operationId": "CheckMinIOVersion”", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/checkOperatorVersionResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/cluster/allocatable-resources": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get allocatable cpu and memory for given number of nodes", - "operationId": "GetAllocatableResources", - "parameters": [ - { - "minimum": 1, - "type": "integer", - "format": "int32", - "name": "num_nodes", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/allocatableResourcesResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/cluster/max-allocatable-memory": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get maximum allocatable memory for given number of nodes", - "operationId": "GetMaxAllocatableMem", - "parameters": [ - { - "minimum": 1, - "type": "integer", - "format": "int32", - "name": "num_nodes", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/maxAllocatableMemResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/directpv/drives": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get directpv drives list", - "operationId": "GetDirectPVDriveList", - "parameters": [ - { - "type": "string", - "name": "nodes", - "in": "query" - }, - { - "type": "string", - "name": "drives", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/getDirectPVDriveListResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/directpv/drives/format": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Format directpv drives from a list", - "operationId": "DirectPVFormatDrive", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/formatConfiguration" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/formatDirectPVDrivesResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/directpv/volumes": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get directpv volumes list", - "operationId": "GetDirectPVVolumeList", - "parameters": [ - { - "type": "string", - "name": "nodes", - "in": "query" - }, - { - "type": "string", - "name": "drives", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/getDirectPVVolumeListResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/get-parity/{nodes}/{disksPerNode}": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Gets parity by sending number of nodes \u0026 number of disks", - "operationId": "GetParity", - "parameters": [ - { - "minimum": 2, - "type": "integer", - "name": "nodes", - "in": "path", - "required": true - }, - { - "minimum": 1, - "type": "integer", - "name": "disksPerNode", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/parityResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/list-pvcs": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "List all PVCs from namespaces that the user has access to", - "operationId": "ListPVCs", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listPVCsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/login": { - "get": { - "security": [], - "tags": [ - "Auth" - ], - "summary": "Returns login strategy, form or sso.", - "operationId": "LoginDetail", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/loginDetails" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/login/oauth2/auth": { - "post": { - "security": [], - "tags": [ - "Auth" - ], - "summary": "Identity Provider oauth2 callback endpoint.", - "operationId": "LoginOauth2Auth", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/loginOauth2AuthRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful login." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/login/operator": { - "post": { - "security": [], - "tags": [ - "Auth" - ], - "summary": "Login to Operator Console.", - "operationId": "LoginOperator", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/loginOperatorRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful login." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/logout": { - "post": { - "tags": [ - "Auth" - ], - "summary": "Logout from Operator.", - "operationId": "Logout", - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/mp-integration": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Returns email registered for marketplace integration", - "operationId": "GetMPIntegration", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "isEmailSet": { - "type": "boolean" - } - } - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Set email to register for marketplace integration", - "operationId": "PostMPIntegration", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/mpIntegration" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespace": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Creates a new Namespace with given information", - "operationId": "CreateNamespace", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/namespace" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/resourcequotas/{resource-quota-name}": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Resource Quota", - "operationId": "GetResourceQuota", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "resource-quota-name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/resourceQuota" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "List Tenants by Namespace", - "operationId": "ListTenants", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "sort_by", - "in": "query" - }, - { - "type": "integer", - "format": "int32", - "name": "offset", - "in": "query" - }, - { - "type": "integer", - "format": "int32", - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listTenantsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Details", - "operationId": "TenantDetails", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tenant" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "put": { - "tags": [ - "OperatorAPI" - ], - "summary": "Update Tenant", - "operationId": "UpdateTenant", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/updateTenantRequest" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "delete": { - "tags": [ - "OperatorAPI" - ], - "summary": "Delete tenant and underlying pvcs", - "operationId": "DeleteTenant", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "schema": { - "$ref": "#/definitions/deleteTenantRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/certificates": { - "put": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Update Certificates", - "operationId": "TenantUpdateCertificate", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/tlsConfiguration" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/configuration": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Configuration", - "operationId": "TenantConfiguration", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tenantConfigurationResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "patch": { - "tags": [ - "OperatorAPI" - ], - "summary": "Update Tenant Configuration", - "operationId": "UpdateTenantConfiguration", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/updateTenantConfigurationRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/csr": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "List Tenant Certificate Signing Request", - "operationId": "ListTenantCertificateSigningRequest", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/csrElements" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/disable-logging": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Disable Tenant Logging", - "operationId": "DisableTenantLogging", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "boolean" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/domains": { - "put": { - "tags": [ - "OperatorAPI" - ], - "summary": "Update Domains for a Tenant", - "operationId": "UpdateTenantDomains", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/updateDomainsRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/enable-logging": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Enable Tenant Logging", - "operationId": "EnableTenantLogging", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "boolean" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/encryption": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Encryption Info", - "operationId": "TenantEncryptionInfo", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/encryptionConfigurationResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "put": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Update Encryption", - "operationId": "TenantUpdateEncryption", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/encryptionConfiguration" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "delete": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Delete Encryption", - "operationId": "TenantDeleteEncryption", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/events": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Events for given Tenant", - "operationId": "GetTenantEvents", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/eventListWrapper" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/identity-provider": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Identity Provider", - "operationId": "TenantIdentityProvider", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/idpConfiguration" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Update Tenant Identity Provider", - "operationId": "UpdateTenantIdentityProvider", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/idpConfiguration" - } - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/log": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Tenant Logs", - "operationId": "GetTenantLogs", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tenantLogs" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "put": { - "tags": [ - "OperatorAPI" - ], - "summary": "Set Tenant Logs", - "operationId": "SetTenantLogs", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/tenantLogs" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "boolean" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/monitoring": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Prometheus Monitoring config info For The Tenant", - "operationId": "GetTenantMonitoring", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tenantMonitoringInfo" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "put": { - "tags": [ - "OperatorAPI" - ], - "summary": "Set Prometheus monitoring fields for tenant", - "operationId": "SetTenantMonitoring", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/tenantMonitoringInfo" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/pods": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Pods For The Tenant", - "operationId": "GetTenantPods", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/tenantPod" - } - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/pods/{podName}": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Logs for Pod", - "operationId": "GetPodLogs", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "podName", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "string" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "delete": { - "tags": [ - "OperatorAPI" - ], - "summary": "Delete pod", - "operationId": "DeletePod", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "podName", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/pods/{podName}/describe": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Describe Pod", - "operationId": "DescribePod", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "podName", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/describePodWrapper" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/pods/{podName}/events": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Events for Pod", - "operationId": "GetPodEvents", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "podName", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/eventListWrapper" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/pools": { - "put": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Update Pools", - "operationId": "TenantUpdatePools", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/poolUpdateRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tenant" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Add Pool", - "operationId": "TenantAddPool", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/pool" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/pvc/{PVCName}": { - "delete": { - "tags": [ - "OperatorAPI" - ], - "summary": "Delete PVC", - "operationId": "DeletePVC", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "PVCName", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/pvcs": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "List all PVCs from given Tenant", - "operationId": "ListPVCsForTenant", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listPVCsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/pvcs/{PVCName}/describe": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Describe output for PVC", - "operationId": "GetPVCDescribe", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "PVCName", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/describePVCWrapper" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/pvcs/{PVCName}/events": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Events for PVC", - "operationId": "GetPVCEvents", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "PVCName", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/eventListWrapper" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/security": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Tenant Security", - "operationId": "TenantSecurity", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tenantSecurityResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Update Tenant Security", - "operationId": "UpdateTenantSecurity", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/updateTenantSecurityRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/set-administrators": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Set the consoleAdmin policy to the specified users and groups", - "operationId": "SetTenantAdministrators", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/setAdministratorsRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/usage": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get Usage For The Tenant", - "operationId": "GetTenantUsage", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tenantUsage" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/namespaces/{namespace}/tenants/{tenant}/yaml": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Get the Tenant YAML", - "operationId": "GetTenantYAML", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tenantYAML" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "put": { - "tags": [ - "OperatorAPI" - ], - "summary": "Put the Tenant YAML", - "operationId": "PutTenantYAML", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/tenantYAML" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/nodes/labels": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "List node labels", - "operationId": "ListNodeLabels", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/nodeLabels" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/session": { - "get": { - "tags": [ - "Auth" - ], - "summary": "Endpoint to check if your session is still valid", - "operationId": "SessionCheck", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/operatorSessionResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/subnet/apikey": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Subnet api key", - "operationId": "OperatorSubnetApiKey", - "parameters": [ - { - "type": "string", - "name": "token", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/operatorSubnetAPIKey" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/subnet/apikey/info": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Subnet API key info", - "operationId": "OperatorSubnetAPIKeyInfo", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/operatorSubnetRegisterAPIKeyResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/subnet/apikey/register": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Register Operator with Subnet", - "operationId": "OperatorSubnetRegisterAPIKey", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/operatorSubnetAPIKey" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/operatorSubnetRegisterAPIKeyResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/subnet/login": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Login to subnet", - "operationId": "OperatorSubnetLogin", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/operatorSubnetLoginRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/operatorSubnetLoginResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/subnet/login/mfa": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Login to subnet using mfa", - "operationId": "OperatorSubnetLoginMFA", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/operatorSubnetLoginMFARequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/operatorSubnetLoginResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/subscription/info": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "Subscription info", - "operationId": "SubscriptionInfo", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/license" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/subscription/namespaces/{namespace}/tenants/{tenant}/activate": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Activate a particular tenant using the existing subscription license", - "operationId": "SubscriptionActivate", - "parameters": [ - { - "type": "string", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "tenant", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/subscription/refresh": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Refresh existing subscription license", - "operationId": "SubscriptionRefresh", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/license" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/subscription/validate": { - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Validates subscription license", - "operationId": "SubscriptionValidate", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/subscriptionValidateRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/license" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/tenants": { - "get": { - "tags": [ - "OperatorAPI" - ], - "summary": "List Tenant of All Namespaces", - "operationId": "ListAllTenants", - "parameters": [ - { - "type": "string", - "name": "sort_by", - "in": "query" - }, - { - "type": "integer", - "format": "int32", - "name": "offset", - "in": "query" - }, - { - "type": "integer", - "format": "int32", - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listTenantsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - }, - "post": { - "tags": [ - "OperatorAPI" - ], - "summary": "Create Tenant", - "operationId": "CreateTenant", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/createTenantRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/createTenantResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - } - }, - "definitions": { - "AwsConfigurationSecretsmanager": { - "type": "object", - "required": [ - "endpoint", - "region", - "credentials" - ], - "properties": { - "credentials": { - "type": "object", - "required": [ - "accesskey", - "secretkey" - ], - "properties": { - "accesskey": { - "type": "string" - }, - "secretkey": { - "type": "string" - }, - "token": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - }, - "kmskey": { - "type": "string" - }, - "region": { - "type": "string" - } - } - }, - "AwsConfigurationSecretsmanagerCredentials": { - "type": "object", - "required": [ - "accesskey", - "secretkey" - ], - "properties": { - "accesskey": { - "type": "string" - }, - "secretkey": { - "type": "string" - }, - "token": { - "type": "string" - } - } - }, - "AzureConfigurationKeyvault": { - "type": "object", - "required": [ - "endpoint" - ], - "properties": { - "credentials": { - "type": "object", - "required": [ - "tenant_id", - "client_id", - "client_secret" - ], - "properties": { - "client_id": { - "type": "string" - }, - "client_secret": { - "type": "string" - }, - "tenant_id": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - } - } - }, - "AzureConfigurationKeyvaultCredentials": { - "type": "object", - "required": [ - "tenant_id", - "client_id", - "client_secret" - ], - "properties": { - "client_id": { - "type": "string" - }, - "client_secret": { - "type": "string" - }, - "tenant_id": { - "type": "string" - } - } - }, - "EncryptionConfigurationAO1KmsMtls": { - "type": "object", - "properties": { - "ca": { - "type": "string" - }, - "crt": { - "type": "string" - }, - "key": { - "type": "string" - } - } - }, - "EncryptionConfigurationResponseAO1KmsMtls": { - "type": "object", - "properties": { - "ca": { - "type": "object", - "$ref": "#/definitions/certificateInfo" - }, - "crt": { - "type": "object", - "$ref": "#/definitions/certificateInfo" - } - } - }, - "GcpConfigurationSecretmanager": { - "type": "object", - "required": [ - "project_id" - ], - "properties": { - "credentials": { - "type": "object", - "properties": { - "client_email": { - "type": "string" - }, - "client_id": { - "type": "string" - }, - "private_key": { - "type": "string" - }, - "private_key_id": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - }, - "project_id": { - "type": "string" - } - } - }, - "GcpConfigurationSecretmanagerCredentials": { - "type": "object", - "properties": { - "client_email": { - "type": "string" - }, - "client_id": { - "type": "string" - }, - "private_key": { - "type": "string" - }, - "private_key_id": { - "type": "string" - } - } - }, - "GemaltoConfigurationKeysecure": { - "type": "object", - "required": [ - "endpoint", - "credentials" - ], - "properties": { - "credentials": { - "type": "object", - "required": [ - "token", - "domain" - ], - "properties": { - "domain": { - "type": "string" - }, - "retry": { - "type": "integer", - "format": "int64" - }, - "token": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - } - } - }, - "GemaltoConfigurationKeysecureCredentials": { - "type": "object", - "required": [ - "token", - "domain" - ], - "properties": { - "domain": { - "type": "string" - }, - "retry": { - "type": "integer", - "format": "int64" - }, - "token": { - "type": "string" - } - } - }, - "GemaltoConfigurationResponseKeysecure": { - "type": "object", - "required": [ - "endpoint", - "credentials" - ], - "properties": { - "credentials": { - "type": "object", - "required": [ - "token", - "domain" - ], - "properties": { - "domain": { - "type": "string" - }, - "retry": { - "type": "integer", - "format": "int64" - }, - "token": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - } - } - }, - "GemaltoConfigurationResponseKeysecureCredentials": { - "type": "object", - "required": [ - "token", - "domain" - ], - "properties": { - "domain": { - "type": "string" - }, - "retry": { - "type": "integer", - "format": "int64" - }, - "token": { - "type": "string" - } - } - }, - "IdpConfigurationActiveDirectory": { - "type": "object", - "required": [ - "url", - "lookup_bind_dn" - ], - "properties": { - "group_search_base_dn": { - "type": "string" - }, - "group_search_filter": { - "type": "string" - }, - "lookup_bind_dn": { - "type": "string" - }, - "lookup_bind_password": { - "type": "string" - }, - "server_insecure": { - "type": "boolean" - }, - "server_start_tls": { - "type": "boolean" - }, - "skip_tls_verification": { - "type": "boolean" - }, - "url": { - "type": "string" - }, - "user_dn_search_base_dn": { - "type": "string" - }, - "user_dn_search_filter": { - "type": "string" - }, - "user_dns": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "IdpConfigurationKeysItems0": { - "type": "object", - "required": [ - "access_key", - "secret_key" - ], - "properties": { - "access_key": { - "type": "string" - }, - "secret_key": { - "type": "string" - } - } - }, - "IdpConfigurationOidc": { - "type": "object", - "required": [ - "configuration_url", - "client_id", - "secret_id", - "claim_name" - ], - "properties": { - "callback_url": { - "type": "string" - }, - "claim_name": { - "type": "string" - }, - "client_id": { - "type": "string" - }, - "configuration_url": { - "type": "string" - }, - "scopes": { - "type": "string" - }, - "secret_id": { - "type": "string" - } - } - }, - "LoginRequestFeatures": { - "type": "object", - "properties": { - "hide_menu": { - "type": "boolean" - } - } - }, - "NodeSelectorTermMatchExpressionsItems0": { - "description": "A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", - "type": "object", - "required": [ - "key", - "operator" - ], - "properties": { - "key": { - "description": "The label key that the selector applies to.", - "type": "string" - }, - "operator": { - "description": "Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.", - "type": "string" - }, - "values": { - "description": "An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.", - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "NodeSelectorTermMatchFieldsItems0": { - "description": "A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", - "type": "object", - "required": [ - "key", - "operator" - ], - "properties": { - "key": { - "description": "The label key that the selector applies to.", - "type": "string" - }, - "operator": { - "description": "Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.", - "type": "string" - }, - "values": { - "description": "An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.", - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "PodAffinityTermLabelSelector": { - "description": "A label query over a set of resources, in this case pods.", - "type": "object", - "properties": { - "matchExpressions": { - "description": "matchExpressions is a list of label selector requirements. The requirements are ANDed.", - "type": "array", - "items": { - "$ref": "#/definitions/PodAffinityTermLabelSelectorMatchExpressionsItems0" - } - }, - "matchLabels": { - "description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.", - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, - "PodAffinityTermLabelSelectorMatchExpressionsItems0": { - "description": "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", - "type": "object", - "required": [ - "key", - "operator" - ], - "properties": { - "key": { - "description": "key is the label key that the selector applies to.", - "type": "string" - }, - "operator": { - "description": "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.", - "type": "string" - }, - "values": { - "description": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.", - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "PoolAffinityNodeAffinity": { - "description": "Describes node affinity scheduling rules for the pod.", - "type": "object", - "properties": { - "preferredDuringSchedulingIgnoredDuringExecution": { - "description": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.", - "type": "array", - "items": { - "$ref": "#/definitions/PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0" - } - }, - "requiredDuringSchedulingIgnoredDuringExecution": { - "description": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node.", - "type": "object", - "required": [ - "nodeSelectorTerms" - ], - "properties": { - "nodeSelectorTerms": { - "description": "Required. A list of node selector terms. The terms are ORed.", - "type": "array", - "items": { - "$ref": "#/definitions/nodeSelectorTerm" - } - } - } - } - } - }, - "PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0": { - "description": "An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).", - "type": "object", - "required": [ - "preference", - "weight" - ], - "properties": { - "preference": { - "description": "A node selector term, associated with the corresponding weight.", - "type": "object", - "$ref": "#/definitions/nodeSelectorTerm" - }, - "weight": { - "description": "Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.", - "type": "integer", - "format": "int32" - } - } - }, - "PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution": { - "description": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node.", - "type": "object", - "required": [ - "nodeSelectorTerms" - ], - "properties": { - "nodeSelectorTerms": { - "description": "Required. A list of node selector terms. The terms are ORed.", - "type": "array", - "items": { - "$ref": "#/definitions/nodeSelectorTerm" - } - } - } - }, - "PoolAffinityPodAffinity": { - "description": "Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, pool, etc. as some other pod(s)).", - "type": "object", - "properties": { - "preferredDuringSchedulingIgnoredDuringExecution": { - "description": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.", - "type": "array", - "items": { - "$ref": "#/definitions/PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0" - } - }, - "requiredDuringSchedulingIgnoredDuringExecution": { - "description": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.", - "type": "array", - "items": { - "$ref": "#/definitions/podAffinityTerm" - } - } - } - }, - "PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0": { - "description": "The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)", - "type": "object", - "required": [ - "podAffinityTerm", - "weight" - ], - "properties": { - "podAffinityTerm": { - "$ref": "#/definitions/podAffinityTerm" - }, - "weight": { - "description": "weight associated with matching the corresponding podAffinityTerm, in the range 1-100.", - "type": "integer", - "format": "int32" - } - } - }, - "PoolAffinityPodAntiAffinity": { - "description": "Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, pool, etc. as some other pod(s)).", - "type": "object", - "properties": { - "preferredDuringSchedulingIgnoredDuringExecution": { - "description": "The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.", - "type": "array", - "items": { - "$ref": "#/definitions/PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0" - } - }, - "requiredDuringSchedulingIgnoredDuringExecution": { - "description": "If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.", - "type": "array", - "items": { - "$ref": "#/definitions/podAffinityTerm" - } - } - } - }, - "PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0": { - "description": "The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)", - "type": "object", - "required": [ - "podAffinityTerm", - "weight" - ], - "properties": { - "podAffinityTerm": { - "$ref": "#/definitions/podAffinityTerm" - }, - "weight": { - "description": "weight associated with matching the corresponding podAffinityTerm, in the range 1-100.", - "type": "integer", - "format": "int32" - } - } - }, - "PoolTolerationsItems0": { - "description": "The pod this Toleration is attached to tolerates any taint that matches the triple \u003ckey,value,effect\u003e using the matching operator \u003coperator\u003e.", - "type": "object", - "properties": { - "effect": { - "description": "Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.", - "type": "string" - }, - "key": { - "description": "Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.", - "type": "string" - }, - "operator": { - "description": "Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.", - "type": "string" - }, - "tolerationSeconds": { - "$ref": "#/definitions/poolTolerationSeconds" - }, - "value": { - "description": "Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.", - "type": "string" - } - } - }, - "PoolVolumeConfiguration": { - "type": "object", - "required": [ - "size" - ], - "properties": { - "annotations": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "size": { - "type": "integer" - }, - "storage_class_name": { - "type": "string" - } - } - }, - "TenantEndpoints": { - "type": "object", - "properties": { - "console": { - "type": "string" - }, - "minio": { - "type": "string" - } - } - }, - "TenantSecurityResponseCustomCertificates": { - "type": "object", - "properties": { - "client": { - "type": "array", - "items": { - "$ref": "#/definitions/certificateInfo" - } - }, - "minio": { - "type": "array", - "items": { - "$ref": "#/definitions/certificateInfo" - } - }, - "minioCAs": { - "type": "array", - "items": { - "$ref": "#/definitions/certificateInfo" - } - } - } - }, - "TenantStatusUsage": { - "type": "object", - "properties": { - "capacity": { - "type": "integer", - "format": "int64" - }, - "capacity_usage": { - "type": "integer", - "format": "int64" - }, - "raw": { - "type": "integer", - "format": "int64" - }, - "raw_usage": { - "type": "integer", - "format": "int64" - } - } - }, - "UpdateTenantSecurityRequestCustomCertificates": { - "type": "object", - "properties": { - "minioCAsCertificates": { - "type": "array", - "items": { - "type": "string" - } - }, - "minioClientCertificates": { - "type": "array", - "items": { - "$ref": "#/definitions/keyPairConfiguration" - } - }, - "minioServerCertificates": { - "type": "array", - "items": { - "$ref": "#/definitions/keyPairConfiguration" - } - }, - "secretsToBeDeleted": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "VaultConfigurationApprole": { - "type": "object", - "required": [ - "id", - "secret" - ], - "properties": { - "engine": { - "type": "string" - }, - "id": { - "type": "string" - }, - "retry": { - "type": "integer", - "format": "int64" - }, - "secret": { - "type": "string" - } - } - }, - "VaultConfigurationResponseApprole": { - "type": "object", - "required": [ - "id", - "secret" - ], - "properties": { - "engine": { - "type": "string" - }, - "id": { - "type": "string" - }, - "retry": { - "type": "integer", - "format": "int64" - }, - "secret": { - "type": "string" - } - } - }, - "VaultConfigurationResponseStatus": { - "type": "object", - "properties": { - "ping": { - "type": "integer", - "format": "int64" - } - } - }, - "VaultConfigurationStatus": { - "type": "object", - "properties": { - "ping": { - "type": "integer", - "format": "int64" - } - } - }, - "allocatableResourcesResponse": { - "type": "object", - "properties": { - "cpu_priority": { - "$ref": "#/definitions/nodeMaxAllocatableResources" - }, - "mem_priority": { - "$ref": "#/definitions/nodeMaxAllocatableResources" - }, - "min_allocatable_cpu": { - "type": "integer", - "format": "int64" - }, - "min_allocatable_mem": { - "type": "integer", - "format": "int64" - } - } - }, - "annotation": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - } - }, - "awsConfiguration": { - "type": "object", - "required": [ - "secretsmanager" - ], - "properties": { - "secretsmanager": { - "type": "object", - "required": [ - "endpoint", - "region", - "credentials" - ], - "properties": { - "credentials": { - "type": "object", - "required": [ - "accesskey", - "secretkey" - ], - "properties": { - "accesskey": { - "type": "string" - }, - "secretkey": { - "type": "string" - }, - "token": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - }, - "kmskey": { - "type": "string" - }, - "region": { - "type": "string" - } - } - } - } - }, - "azureConfiguration": { - "type": "object", - "required": [ - "keyvault" - ], - "properties": { - "keyvault": { - "type": "object", - "required": [ - "endpoint" - ], - "properties": { - "credentials": { - "type": "object", - "required": [ - "tenant_id", - "client_id", - "client_secret" - ], - "properties": { - "client_id": { - "type": "string" - }, - "client_secret": { - "type": "string" - }, - "tenant_id": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - } - } - } - } - }, - "certificateInfo": { - "type": "object", - "properties": { - "domains": { - "type": "array", - "items": { - "type": "string" - } - }, - "expiry": { - "type": "string" - }, - "name": { - "type": "string" - }, - "serialNumber": { - "type": "string" - } - } - }, - "checkOperatorVersionResponse": { - "type": "object", - "properties": { - "current_version": { - "type": "string" - }, - "latest_version": { - "type": "string" - } - } - }, - "condition": { - "type": "object", - "properties": { - "status": { - "type": "string" - }, - "type": { - "type": "string" - } - } - }, - "configMap": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "optional": { - "type": "boolean" - } - } - }, - "configureTenantRequest": { - "type": "object", - "properties": { - "prometheusEnabled": { - "type": "boolean" - } - } - }, - "container": { - "type": "object", - "properties": { - "args": { - "type": "array", - "items": { - "type": "string" - } - }, - "containerID": { - "type": "string" - }, - "environmentVariables": { - "type": "array", - "items": { - "$ref": "#/definitions/environmentVariable" - } - }, - "hostPorts": { - "type": "array", - "items": { - "type": "string" - } - }, - "image": { - "type": "string" - }, - "imageID": { - "type": "string" - }, - "lastState": { - "$ref": "#/definitions/state" - }, - "mounts": { - "type": "array", - "items": { - "$ref": "#/definitions/mount" - } - }, - "name": { - "type": "string" - }, - "ports": { - "type": "array", - "items": { - "type": "string" - } - }, - "ready": { - "type": "boolean" - }, - "restartCount": { - "type": "integer" - }, - "state": { - "$ref": "#/definitions/state" - } - } - }, - "createTenantRequest": { - "type": "object", - "required": [ - "name", - "namespace", - "pools" - ], - "properties": { - "access_key": { - "type": "string" - }, - "annotations": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "domains": { - "type": "object", - "$ref": "#/definitions/domainsConfiguration" - }, - "enable_console": { - "type": "boolean", - "default": true - }, - "enable_prometheus": { - "type": "boolean", - "default": false - }, - "enable_tls": { - "type": "boolean", - "default": true - }, - "encryption": { - "type": "object", - "$ref": "#/definitions/encryptionConfiguration" - }, - "environmentVariables": { - "type": "array", - "items": { - "$ref": "#/definitions/environmentVariable" - } - }, - "erasureCodingParity": { - "type": "integer" - }, - "expose_console": { - "type": "boolean" - }, - "expose_minio": { - "type": "boolean" - }, - "idp": { - "type": "object", - "$ref": "#/definitions/idpConfiguration" - }, - "image": { - "type": "string" - }, - "image_pull_secret": { - "type": "string" - }, - "image_registry": { - "$ref": "#/definitions/imageRegistry" - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "logSearchConfiguration": { - "$ref": "#/definitions/logSearchConfiguration" - }, - "mount_path": { - "type": "string" - }, - "name": { - "type": "string", - "pattern": "^[a-z0-9-]{3,63}$" - }, - "namespace": { - "type": "string" - }, - "pools": { - "type": "array", - "items": { - "$ref": "#/definitions/pool" - } - }, - "prometheusConfiguration": { - "$ref": "#/definitions/prometheusConfiguration" - }, - "secret_key": { - "type": "string" - }, - "tls": { - "type": "object", - "$ref": "#/definitions/tlsConfiguration" - } - } - }, - "createTenantResponse": { - "type": "object", - "properties": { - "console": { - "type": "array", - "items": { - "$ref": "#/definitions/tenantResponseItem" - } - }, - "externalIDP": { - "type": "boolean" - } - } - }, - "csrElement": { - "type": "object", - "properties": { - "annotations": { - "type": "array", - "items": { - "$ref": "#/definitions/annotation" - } - }, - "deletion_grace_period_seconds": { - "type": "integer", - "format": "int64" - }, - "generate_name": { - "type": "string" - }, - "generation": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "resource_version": { - "type": "string" - }, - "status": { - "type": "string" - } - } - }, - "csrElements": { - "type": "object", - "properties": { - "csrElement": { - "type": "array", - "items": { - "$ref": "#/definitions/csrElement" - } - } - } - }, - "deleteTenantRequest": { - "type": "object", - "properties": { - "delete_pvcs": { - "type": "boolean" - } - } - }, - "describePVCWrapper": { - "type": "object", - "properties": { - "accessModes": { - "type": "array", - "items": { - "type": "string" - } - }, - "annotations": { - "type": "array", - "items": { - "$ref": "#/definitions/annotation" - } - }, - "capacity": { - "type": "string" - }, - "finalizers": { - "type": "array", - "items": { - "type": "string" - } - }, - "labels": { - "type": "array", - "items": { - "$ref": "#/definitions/label" - } - }, - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "status": { - "type": "string" - }, - "storageClass": { - "type": "string" - }, - "volume": { - "type": "string" - }, - "volumeMode": { - "type": "string" - } - } - }, - "describePodWrapper": { - "type": "object", - "properties": { - "annotations": { - "type": "array", - "items": { - "$ref": "#/definitions/annotation" - } - }, - "conditions": { - "type": "array", - "items": { - "$ref": "#/definitions/condition" - } - }, - "containers": { - "type": "array", - "items": { - "$ref": "#/definitions/container" - } - }, - "controllerRef": { - "type": "string" - }, - "deletionGracePeriodSeconds": { - "type": "integer" - }, - "deletionTimestamp": { - "type": "string" - }, - "labels": { - "type": "array", - "items": { - "$ref": "#/definitions/label" - } - }, - "message": { - "type": "string" - }, - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "nodeName": { - "type": "string" - }, - "nodeSelector": { - "type": "array", - "items": { - "$ref": "#/definitions/nodeSelector" - } - }, - "phase": { - "type": "string" - }, - "podIP": { - "type": "string" - }, - "priority": { - "type": "integer" - }, - "priorityClassName": { - "type": "string" - }, - "qosClass": { - "type": "string" - }, - "reason": { - "type": "string" - }, - "startTime": { - "type": "string" - }, - "tolerations": { - "type": "array", - "items": { - "$ref": "#/definitions/toleration" - } - }, - "volumes": { - "type": "array", - "items": { - "$ref": "#/definitions/volume" - } - } - } - }, - "directPVDriveInfo": { - "type": "object", - "properties": { - "allocated": { - "type": "number", - "format": "int64" - }, - "capacity": { - "type": "number", - "format": "int64" - }, - "drive": { - "type": "string" - }, - "message": { - "type": "string" - }, - "node": { - "type": "string" - }, - "status": { - "type": "string" - }, - "volumes": { - "type": "number", - "format": "int64" - } - } - }, - "directPVVolumeInfo": { - "type": "object", - "properties": { - "capacity": { - "type": "number", - "format": "int64" - }, - "drive": { - "type": "string" - }, - "node": { - "type": "string" - }, - "volume": { - "type": "string" - } - } - }, - "domainsConfiguration": { - "type": "object", - "properties": { - "console": { - "type": "string" - }, - "minio": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "encryptionConfiguration": { - "allOf": [ - { - "$ref": "#/definitions/metadataFields" - }, - { - "type": "object", - "properties": { - "aws": { - "type": "object", - "$ref": "#/definitions/awsConfiguration" - }, - "azure": { - "type": "object", - "$ref": "#/definitions/azureConfiguration" - }, - "gcp": { - "type": "object", - "$ref": "#/definitions/gcpConfiguration" - }, - "gemalto": { - "type": "object", - "$ref": "#/definitions/gemaltoConfiguration" - }, - "image": { - "type": "string" - }, - "kms_mtls": { - "type": "object", - "properties": { - "ca": { - "type": "string" - }, - "crt": { - "type": "string" - }, - "key": { - "type": "string" - } - } - }, - "minio_mtls": { - "type": "object", - "$ref": "#/definitions/keyPairConfiguration" - }, - "raw": { - "type": "string" - }, - "replicas": { - "type": "string" - }, - "secretsToBeDeleted": { - "type": "array", - "items": { - "type": "string" - } - }, - "securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - }, - "server_tls": { - "type": "object", - "$ref": "#/definitions/keyPairConfiguration" - }, - "vault": { - "type": "object", - "$ref": "#/definitions/vaultConfiguration" - } - } - } - ] - }, - "encryptionConfigurationResponse": { - "allOf": [ - { - "$ref": "#/definitions/metadataFields" - }, - { - "type": "object", - "properties": { - "aws": { - "type": "object", - "$ref": "#/definitions/awsConfiguration" - }, - "azure": { - "type": "object", - "$ref": "#/definitions/azureConfiguration" - }, - "gcp": { - "type": "object", - "$ref": "#/definitions/gcpConfiguration" - }, - "gemalto": { - "type": "object", - "$ref": "#/definitions/gemaltoConfigurationResponse" - }, - "image": { - "type": "string" - }, - "kms_mtls": { - "type": "object", - "properties": { - "ca": { - "type": "object", - "$ref": "#/definitions/certificateInfo" - }, - "crt": { - "type": "object", - "$ref": "#/definitions/certificateInfo" - } - } - }, - "minio_mtls": { - "type": "object", - "$ref": "#/definitions/certificateInfo" - }, - "raw": { - "type": "string" - }, - "replicas": { - "type": "string" - }, - "securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - }, - "server_tls": { - "type": "object", - "$ref": "#/definitions/certificateInfo" - }, - "vault": { - "type": "object", - "$ref": "#/definitions/vaultConfigurationResponse" - } - } - } - ] - }, - "environmentVariable": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - } - }, - "error": { - "type": "object", - "required": [ - "message", - "detailedMessage" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "detailedMessage": { - "type": "string" - }, - "message": { - "type": "string" - } - } - }, - "eventListElement": { - "type": "object", - "properties": { - "event_type": { - "type": "string" - }, - "last_seen": { - "type": "integer", - "format": "int64" - }, - "message": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "object": { - "type": "string" - }, - "reason": { - "type": "string" - } - } - }, - "eventListWrapper": { - "type": "array", - "items": { - "$ref": "#/definitions/eventListElement" - } - }, - "formatConfiguration": { - "type": "object", - "required": [ - "drives", - "force" - ], - "properties": { - "drives": { - "type": "array", - "minLength": 1, - "items": { - "type": "string" - } - }, - "force": { - "type": "boolean" - } - } - }, - "formatDirectPVDrivesResponse": { - "type": "object", - "properties": { - "formatIssuesList": { - "type": "array", - "items": { - "$ref": "#/definitions/pvFormatErrorResponse" - } - } - } - }, - "gcpConfiguration": { - "type": "object", - "required": [ - "secretmanager" - ], - "properties": { - "secretmanager": { - "type": "object", - "required": [ - "project_id" - ], - "properties": { - "credentials": { - "type": "object", - "properties": { - "client_email": { - "type": "string" - }, - "client_id": { - "type": "string" - }, - "private_key": { - "type": "string" - }, - "private_key_id": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - }, - "project_id": { - "type": "string" - } - } - } - } - }, - "gemaltoConfiguration": { - "type": "object", - "required": [ - "keysecure" - ], - "properties": { - "keysecure": { - "type": "object", - "required": [ - "endpoint", - "credentials" - ], - "properties": { - "credentials": { - "type": "object", - "required": [ - "token", - "domain" - ], - "properties": { - "domain": { - "type": "string" - }, - "retry": { - "type": "integer", - "format": "int64" - }, - "token": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - } - } - } - } - }, - "gemaltoConfigurationResponse": { - "type": "object", - "required": [ - "keysecure" - ], - "properties": { - "keysecure": { - "type": "object", - "required": [ - "endpoint", - "credentials" - ], - "properties": { - "credentials": { - "type": "object", - "required": [ - "token", - "domain" - ], - "properties": { - "domain": { - "type": "string" - }, - "retry": { - "type": "integer", - "format": "int64" - }, - "token": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - } - } - } - } - }, - "getDirectPVDriveListResponse": { - "type": "object", - "properties": { - "drives": { - "type": "array", - "items": { - "$ref": "#/definitions/directPVDriveInfo" - } - } - } - }, - "getDirectPVVolumeListResponse": { - "type": "object", - "properties": { - "volumes": { - "type": "array", - "items": { - "$ref": "#/definitions/directPVVolumeInfo" - } - } - } - }, - "idpConfiguration": { - "type": "object", - "properties": { - "active_directory": { - "type": "object", - "required": [ - "url", - "lookup_bind_dn" - ], - "properties": { - "group_search_base_dn": { - "type": "string" - }, - "group_search_filter": { - "type": "string" - }, - "lookup_bind_dn": { - "type": "string" - }, - "lookup_bind_password": { - "type": "string" - }, - "server_insecure": { - "type": "boolean" - }, - "server_start_tls": { - "type": "boolean" - }, - "skip_tls_verification": { - "type": "boolean" - }, - "url": { - "type": "string" - }, - "user_dn_search_base_dn": { - "type": "string" - }, - "user_dn_search_filter": { - "type": "string" - }, - "user_dns": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "keys": { - "type": "array", - "items": { - "$ref": "#/definitions/IdpConfigurationKeysItems0" - } - }, - "oidc": { - "type": "object", - "required": [ - "configuration_url", - "client_id", - "secret_id", - "claim_name" - ], - "properties": { - "callback_url": { - "type": "string" - }, - "claim_name": { - "type": "string" - }, - "client_id": { - "type": "string" - }, - "configuration_url": { - "type": "string" - }, - "scopes": { - "type": "string" - }, - "secret_id": { - "type": "string" - } - } - } - } - }, - "imageRegistry": { - "type": "object", - "required": [ - "registry", - "username", - "password" - ], - "properties": { - "password": { - "type": "string" - }, - "registry": { - "type": "string" - }, - "username": { - "type": "string" - } - } - }, - "keyPairConfiguration": { - "type": "object", - "required": [ - "crt", - "key" - ], - "properties": { - "crt": { - "type": "string" - }, - "key": { - "type": "string" - } - } - }, - "label": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - } - }, - "license": { - "type": "object", - "properties": { - "account_id": { - "type": "integer" - }, - "email": { - "type": "string" - }, - "expires_at": { - "type": "string" - }, - "organization": { - "type": "string" - }, - "plan": { - "type": "string" - }, - "storage_capacity": { - "type": "integer" - } - } - }, - "listPVCsResponse": { - "type": "object", - "properties": { - "pvcs": { - "type": "array", - "items": { - "$ref": "#/definitions/pvcsListResponse" - } - } - } - }, - "listTenantsResponse": { - "type": "object", - "properties": { - "tenants": { - "type": "array", - "title": "list of resulting tenants", - "items": { - "$ref": "#/definitions/tenantList" - } - }, - "total": { - "type": "integer", - "format": "int64", - "title": "number of tenants accessible to tenant user" - } - } - }, - "logSearchConfiguration": { - "type": "object", - "properties": { - "image": { - "type": "string" - }, - "postgres_image": { - "type": "string" - }, - "postgres_init_image": { - "type": "string" - }, - "postgres_securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - }, - "securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - }, - "storageClass": { - "type": "string", - "default": "" - }, - "storageSize": { - "type": "number", - "default": 5 - } - } - }, - "loginDetails": { - "type": "object", - "properties": { - "isDirectPV": { - "type": "boolean" - }, - "isK8S": { - "type": "boolean" - }, - "loginStrategy": { - "type": "string", - "enum": [ - "form", - "redirect", - "service-account", - "redirect-service-account" - ] - }, - "redirectRules": { - "type": "array", - "items": { - "$ref": "#/definitions/redirectRule" - } - } - } - }, - "loginOauth2AuthRequest": { - "type": "object", - "required": [ - "state", - "code" - ], - "properties": { - "code": { - "type": "string" - }, - "state": { - "type": "string" - } - } - }, - "loginOperatorRequest": { - "type": "object", - "required": [ - "jwt" - ], - "properties": { - "jwt": { - "type": "string" - } - } - }, - "loginRequest": { - "type": "object", - "properties": { - "accessKey": { - "type": "string" - }, - "features": { - "type": "object", - "properties": { - "hide_menu": { - "type": "boolean" - } - } - }, - "secretKey": { - "type": "string" - }, - "sts": { - "type": "string" - } - } - }, - "maxAllocatableMemResponse": { - "type": "object", - "properties": { - "max_memory": { - "type": "integer", - "format": "int64" - } - } - }, - "metadataFields": { - "type": "object", - "properties": { - "annotations": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "node_selector": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, - "mount": { - "type": "object", - "properties": { - "mountPath": { - "type": "string" - }, - "name": { - "type": "string" - }, - "readOnly": { - "type": "boolean" - }, - "subPath": { - "type": "string" - } - } - }, - "mpIntegration": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "isInEU": { - "type": "boolean" - } - } - }, - "namespace": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - } - } - }, - "nodeLabels": { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "nodeMaxAllocatableResources": { - "type": "object", - "properties": { - "max_allocatable_cpu": { - "type": "integer", - "format": "int64" - }, - "max_allocatable_mem": { - "type": "integer", - "format": "int64" - } - } - }, - "nodeSelector": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - } - }, - "nodeSelectorTerm": { - "description": "A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.", - "type": "object", - "properties": { - "matchExpressions": { - "description": "A list of node selector requirements by node's labels.", - "type": "array", - "items": { - "$ref": "#/definitions/NodeSelectorTermMatchExpressionsItems0" - } - }, - "matchFields": { - "description": "A list of node selector requirements by node's fields.", - "type": "array", - "items": { - "$ref": "#/definitions/NodeSelectorTermMatchFieldsItems0" - } - } - } - }, - "operatorSessionResponse": { - "type": "object", - "properties": { - "directPV": { - "type": "boolean" - }, - "features": { - "type": "array", - "items": { - "type": "string" - } - }, - "operator": { - "type": "boolean" - }, - "permissions": { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "status": { - "type": "string", - "enum": [ - "ok" - ] - } - } - }, - "operatorSubnetAPIKey": { - "type": "object", - "properties": { - "apiKey": { - "type": "string" - } - } - }, - "operatorSubnetLoginMFARequest": { - "type": "object", - "required": [ - "username", - "otp", - "mfa_token" - ], - "properties": { - "mfa_token": { - "type": "string" - }, - "otp": { - "type": "string" - }, - "username": { - "type": "string" - } - } - }, - "operatorSubnetLoginRequest": { - "type": "object", - "properties": { - "password": { - "type": "string" - }, - "username": { - "type": "string" - } - } - }, - "operatorSubnetLoginResponse": { - "type": "object", - "properties": { - "access_token": { - "type": "string" - }, - "mfa_token": { - "type": "string" - } - } - }, - "operatorSubnetRegisterAPIKeyResponse": { - "type": "object", - "properties": { - "registered": { - "type": "boolean" - } - } - }, - "parityResponse": { - "type": "array", - "items": { - "type": "string" - } - }, - "podAffinityTerm": { - "description": "Required. A pod affinity term, associated with the corresponding weight.", - "type": "object", - "required": [ - "topologyKey" - ], - "properties": { - "labelSelector": { - "description": "A label query over a set of resources, in this case pods.", - "type": "object", - "properties": { - "matchExpressions": { - "description": "matchExpressions is a list of label selector requirements. The requirements are ANDed.", - "type": "array", - "items": { - "$ref": "#/definitions/PodAffinityTermLabelSelectorMatchExpressionsItems0" - } - }, - "matchLabels": { - "description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.", - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, - "namespaces": { - "description": "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"", - "type": "array", - "items": { - "type": "string" - } - }, - "topologyKey": { - "description": "This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.", - "type": "string" - } - } - }, - "pool": { - "type": "object", - "required": [ - "servers", - "volumes_per_server", - "volume_configuration" - ], - "properties": { - "affinity": { - "$ref": "#/definitions/poolAffinity" - }, - "name": { - "type": "string" - }, - "node_selector": { - "description": "NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/", - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "resources": { - "$ref": "#/definitions/poolResources" - }, - "runtimeClassName": { - "type": "string" - }, - "securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - }, - "servers": { - "type": "integer" - }, - "tolerations": { - "$ref": "#/definitions/poolTolerations" - }, - "volume_configuration": { - "type": "object", - "required": [ - "size" - ], - "properties": { - "annotations": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "size": { - "type": "integer" - }, - "storage_class_name": { - "type": "string" - } - } - }, - "volumes_per_server": { - "type": "integer", - "format": "int32" - } - } - }, - "poolAffinity": { - "description": "If specified, affinity will define the pod's scheduling constraints", - "type": "object", - "properties": { - "nodeAffinity": { - "description": "Describes node affinity scheduling rules for the pod.", - "type": "object", - "properties": { - "preferredDuringSchedulingIgnoredDuringExecution": { - "description": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.", - "type": "array", - "items": { - "$ref": "#/definitions/PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0" - } - }, - "requiredDuringSchedulingIgnoredDuringExecution": { - "description": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node.", - "type": "object", - "required": [ - "nodeSelectorTerms" - ], - "properties": { - "nodeSelectorTerms": { - "description": "Required. A list of node selector terms. The terms are ORed.", - "type": "array", - "items": { - "$ref": "#/definitions/nodeSelectorTerm" - } - } - } - } - } - }, - "podAffinity": { - "description": "Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, pool, etc. as some other pod(s)).", - "type": "object", - "properties": { - "preferredDuringSchedulingIgnoredDuringExecution": { - "description": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.", - "type": "array", - "items": { - "$ref": "#/definitions/PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0" - } - }, - "requiredDuringSchedulingIgnoredDuringExecution": { - "description": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.", - "type": "array", - "items": { - "$ref": "#/definitions/podAffinityTerm" - } - } - } - }, - "podAntiAffinity": { - "description": "Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, pool, etc. as some other pod(s)).", - "type": "object", - "properties": { - "preferredDuringSchedulingIgnoredDuringExecution": { - "description": "The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.", - "type": "array", - "items": { - "$ref": "#/definitions/PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0" - } - }, - "requiredDuringSchedulingIgnoredDuringExecution": { - "description": "If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.", - "type": "array", - "items": { - "$ref": "#/definitions/podAffinityTerm" - } - } - } - } - } - }, - "poolResources": { - "description": "If provided, use these requests and limit for cpu/memory resource allocation", - "type": "object", - "properties": { - "limits": { - "description": "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/", - "type": "object", - "additionalProperties": { - "type": "integer", - "format": "int64" - } - }, - "requests": { - "description": "Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/", - "type": "object", - "additionalProperties": { - "type": "integer", - "format": "int64" - } - } - } - }, - "poolTolerationSeconds": { - "description": "TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.", - "type": "object", - "required": [ - "seconds" - ], - "properties": { - "seconds": { - "type": "integer", - "format": "int64" - } - } - }, - "poolTolerations": { - "description": "Tolerations allows users to set entries like effect, key, operator, value.", - "type": "array", - "items": { - "$ref": "#/definitions/PoolTolerationsItems0" - } - }, - "poolUpdateRequest": { - "type": "object", - "required": [ - "pools" - ], - "properties": { - "pools": { - "type": "array", - "items": { - "$ref": "#/definitions/pool" - } - } - } - }, - "projectedVolume": { - "type": "object", - "properties": { - "sources": { - "type": "array", - "items": { - "$ref": "#/definitions/projectedVolumeSource" - } - } - } - }, - "projectedVolumeSource": { - "type": "object", - "properties": { - "configMap": { - "$ref": "#/definitions/configMap" - }, - "downwardApi": { - "type": "boolean" - }, - "secret": { - "$ref": "#/definitions/secret" - }, - "serviceAccountToken": { - "$ref": "#/definitions/serviceAccountToken" - } - } - }, - "prometheusConfiguration": { - "type": "object", - "properties": { - "image": { - "type": "string" - }, - "init_image": { - "type": "string" - }, - "securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - }, - "sidecar_image": { - "type": "string" - }, - "storageClass": { - "type": "string", - "default": "" - }, - "storageSize": { - "type": "number", - "default": 5 - } - } - }, - "pvFormatErrorResponse": { - "type": "object", - "properties": { - "drive": { - "type": "string" - }, - "error": { - "type": "string" - }, - "node": { - "type": "string" - } - } - }, - "pvc": { - "type": "object", - "properties": { - "claimName": { - "type": "string" - }, - "readOnly": { - "type": "boolean" - } - } - }, - "pvcsListResponse": { - "type": "object", - "properties": { - "age": { - "type": "string" - }, - "capacity": { - "type": "string" - }, - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "status": { - "type": "string" - }, - "storageClass": { - "type": "string" - }, - "tenant": { - "type": "string" - }, - "volume": { - "type": "string" - } - } - }, - "redirectRule": { - "type": "object", - "properties": { - "displayName": { - "type": "string" - }, - "redirect": { - "type": "string" - } - } - }, - "resourceQuota": { - "type": "object", - "properties": { - "elements": { - "type": "array", - "items": { - "$ref": "#/definitions/resourceQuotaElement" - } - }, - "name": { - "type": "string" - } - } - }, - "resourceQuotaElement": { - "type": "object", - "properties": { - "hard": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "used": { - "type": "integer", - "format": "int64" - } - } - }, - "secret": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "optional": { - "type": "boolean" - } - } - }, - "securityContext": { - "type": "object", - "required": [ - "runAsUser", - "runAsGroup", - "runAsNonRoot" - ], - "properties": { - "fsGroup": { - "type": "string" - }, - "fsGroupChangePolicy": { - "type": "string" - }, - "runAsGroup": { - "type": "string" - }, - "runAsNonRoot": { - "type": "boolean" - }, - "runAsUser": { - "type": "string" - } - } - }, - "serviceAccountToken": { - "type": "object", - "properties": { - "expirationSeconds": { - "type": "integer" - } - } - }, - "setAdministratorsRequest": { - "type": "object", - "properties": { - "group_dns": { - "type": "array", - "items": { - "type": "string" - } - }, - "user_dns": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "state": { - "type": "object", - "properties": { - "exitCode": { - "type": "integer" - }, - "finished": { - "type": "string" - }, - "message": { - "type": "string" - }, - "reason": { - "type": "string" - }, - "signal": { - "type": "integer" - }, - "started": { - "type": "string" - }, - "state": { - "type": "string" - } - } - }, - "subscriptionValidateRequest": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "license": { - "type": "string" - }, - "password": { - "type": "string" - } - } - }, - "tenant": { - "type": "object", - "properties": { - "creation_date": { - "type": "string" - }, - "currentState": { - "type": "string" - }, - "deletion_date": { - "type": "string" - }, - "domains": { - "$ref": "#/definitions/domainsConfiguration" - }, - "enable_prometheus": { - "type": "boolean" - }, - "encryptionEnabled": { - "type": "boolean" - }, - "endpoints": { - "type": "object", - "properties": { - "console": { - "type": "string" - }, - "minio": { - "type": "string" - } - } - }, - "idpAdEnabled": { - "type": "boolean" - }, - "idpOidcEnabled": { - "type": "boolean" - }, - "image": { - "type": "string" - }, - "logEnabled": { - "type": "boolean" - }, - "minioTLS": { - "type": "boolean" - }, - "monitoringEnabled": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "pools": { - "type": "array", - "items": { - "$ref": "#/definitions/pool" - } - }, - "status": { - "$ref": "#/definitions/tenantStatus" - }, - "subnet_license": { - "$ref": "#/definitions/license" - }, - "total_size": { - "type": "integer", - "format": "int64" - } - } - }, - "tenantConfigurationResponse": { - "type": "object", - "properties": { - "environmentVariables": { - "type": "array", - "items": { - "$ref": "#/definitions/environmentVariable" - } - } - } - }, - "tenantList": { - "type": "object", - "properties": { - "capacity": { - "type": "integer", - "format": "int64" - }, - "capacity_raw": { - "type": "integer", - "format": "int64" - }, - "capacity_raw_usage": { - "type": "integer", - "format": "int64" - }, - "capacity_usage": { - "type": "integer", - "format": "int64" - }, - "creation_date": { - "type": "string" - }, - "currentState": { - "type": "string" - }, - "deletion_date": { - "type": "string" - }, - "domains": { - "type": "object", - "$ref": "#/definitions/domainsConfiguration" - }, - "health_status": { - "type": "string" - }, - "instance_count": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "pool_count": { - "type": "integer" - }, - "tiers": { - "type": "array", - "items": { - "$ref": "#/definitions/tenantTierElement" - } - }, - "total_size": { - "type": "integer" - }, - "volume_count": { - "type": "integer" - } - } - }, - "tenantLogs": { - "type": "object", - "properties": { - "annotations": { - "type": "array", - "items": { - "$ref": "#/definitions/annotation" - } - }, - "dbAnnotations": { - "type": "array", - "items": { - "$ref": "#/definitions/annotation" - } - }, - "dbImage": { - "type": "string" - }, - "dbInitImage": { - "type": "string" - }, - "dbLabels": { - "type": "array", - "items": { - "$ref": "#/definitions/label" - } - }, - "dbNodeSelector": { - "type": "array", - "items": { - "$ref": "#/definitions/nodeSelector" - } - }, - "dbSecurityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - }, - "dbServiceAccountName": { - "type": "string" - }, - "disabled": { - "type": "boolean" - }, - "diskCapacityGB": { - "type": "string" - }, - "image": { - "type": "string" - }, - "labels": { - "type": "array", - "items": { - "$ref": "#/definitions/label" - } - }, - "logCPURequest": { - "type": "string" - }, - "logDBCPURequest": { - "type": "string" - }, - "logDBMemRequest": { - "type": "string" - }, - "logMemRequest": { - "type": "string" - }, - "nodeSelector": { - "type": "array", - "items": { - "$ref": "#/definitions/nodeSelector" - } - }, - "securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - }, - "serviceAccountName": { - "type": "string" - } - } - }, - "tenantMonitoringInfo": { - "type": "object", - "properties": { - "annotations": { - "type": "array", - "items": { - "$ref": "#/definitions/annotation" - } - }, - "diskCapacityGB": { - "type": "string" - }, - "image": { - "type": "string" - }, - "initImage": { - "type": "string" - }, - "labels": { - "type": "array", - "items": { - "$ref": "#/definitions/label" - } - }, - "monitoringCPURequest": { - "type": "string" - }, - "monitoringMemRequest": { - "type": "string" - }, - "nodeSelector": { - "type": "array", - "items": { - "$ref": "#/definitions/nodeSelector" - } - }, - "prometheusEnabled": { - "type": "boolean" - }, - "securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - }, - "serviceAccountName": { - "type": "string" - }, - "sidecarImage": { - "type": "string" - }, - "storageClassName": { - "type": "string" - }, - "toggle": { - "type": "boolean" - } - } - }, - "tenantPod": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "node": { - "type": "string" - }, - "podIP": { - "type": "string" - }, - "restarts": { - "type": "integer" - }, - "status": { - "type": "string" - }, - "timeCreated": { - "type": "integer" - } - } - }, - "tenantResponseItem": { - "type": "object", - "properties": { - "access_key": { - "type": "string" - }, - "secret_key": { - "type": "string" - }, - "url": { - "type": "string" - } - } - }, - "tenantSecurityResponse": { - "type": "object", - "properties": { - "autoCert": { - "type": "boolean" - }, - "customCertificates": { - "type": "object", - "properties": { - "client": { - "type": "array", - "items": { - "$ref": "#/definitions/certificateInfo" - } - }, - "minio": { - "type": "array", - "items": { - "$ref": "#/definitions/certificateInfo" - } - }, - "minioCAs": { - "type": "array", - "items": { - "$ref": "#/definitions/certificateInfo" - } - } - } - }, - "securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - } - } - }, - "tenantStatus": { - "type": "object", - "properties": { - "drives_healing": { - "type": "integer", - "format": "int32" - }, - "drives_offline": { - "type": "integer", - "format": "int32" - }, - "drives_online": { - "type": "integer", - "format": "int32" - }, - "health_status": { - "type": "string" - }, - "usage": { - "type": "object", - "properties": { - "capacity": { - "type": "integer", - "format": "int64" - }, - "capacity_usage": { - "type": "integer", - "format": "int64" - }, - "raw": { - "type": "integer", - "format": "int64" - }, - "raw_usage": { - "type": "integer", - "format": "int64" - } - } - }, - "write_quorum": { - "type": "integer", - "format": "int32" - } - } - }, - "tenantTierElement": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "size": { - "type": "integer", - "format": "int64" - }, - "type": { - "type": "string" - } - } - }, - "tenantUsage": { - "type": "object", - "properties": { - "disk_used": { - "type": "integer", - "format": "int64" - }, - "used": { - "type": "integer", - "format": "int64" - } - } - }, - "tenantYAML": { - "type": "object", - "properties": { - "yaml": { - "type": "string" - } - } - }, - "tlsConfiguration": { - "type": "object", - "properties": { - "minioCAsCertificates": { - "type": "array", - "items": { - "type": "string" - } - }, - "minioClientCertificates": { - "type": "array", - "items": { - "$ref": "#/definitions/keyPairConfiguration" - } - }, - "minioServerCertificates": { - "type": "array", - "items": { - "$ref": "#/definitions/keyPairConfiguration" - } - } - } - }, - "toleration": { - "type": "object", - "properties": { - "effect": { - "type": "string" - }, - "key": { - "type": "string" - }, - "operator": { - "type": "string" - }, - "tolerationSeconds": { - "type": "integer" - }, - "value": { - "type": "string" - } - } - }, - "updateDomainsRequest": { - "type": "object", - "properties": { - "domains": { - "$ref": "#/definitions/domainsConfiguration" - } - } - }, - "updateTenantConfigurationRequest": { - "type": "object", - "properties": { - "environmentVariables": { - "type": "array", - "items": { - "$ref": "#/definitions/environmentVariable" - } - }, - "keysToBeDeleted": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "updateTenantRequest": { - "type": "object", - "properties": { - "enable_prometheus": { - "type": "boolean" - }, - "image": { - "type": "string", - "pattern": "^((.*?)/(.*?):(.+))$" - }, - "image_pull_secret": { - "type": "string" - }, - "image_registry": { - "$ref": "#/definitions/imageRegistry" - } - } - }, - "updateTenantSecurityRequest": { - "type": "object", - "properties": { - "autoCert": { - "type": "boolean" - }, - "customCertificates": { - "type": "object", - "properties": { - "minioCAsCertificates": { - "type": "array", - "items": { - "type": "string" - } - }, - "minioClientCertificates": { - "type": "array", - "items": { - "$ref": "#/definitions/keyPairConfiguration" - } - }, - "minioServerCertificates": { - "type": "array", - "items": { - "$ref": "#/definitions/keyPairConfiguration" - } - }, - "secretsToBeDeleted": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "securityContext": { - "type": "object", - "$ref": "#/definitions/securityContext" - } - } - }, - "vaultConfiguration": { - "type": "object", - "required": [ - "endpoint", - "approle" - ], - "properties": { - "approle": { - "type": "object", - "required": [ - "id", - "secret" - ], - "properties": { - "engine": { - "type": "string" - }, - "id": { - "type": "string" - }, - "retry": { - "type": "integer", - "format": "int64" - }, - "secret": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - }, - "engine": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "status": { - "type": "object", - "properties": { - "ping": { - "type": "integer", - "format": "int64" - } - } - } - } - }, - "vaultConfigurationResponse": { - "type": "object", - "required": [ - "endpoint", - "approle" - ], - "properties": { - "approle": { - "type": "object", - "required": [ - "id", - "secret" - ], - "properties": { - "engine": { - "type": "string" - }, - "id": { - "type": "string" - }, - "retry": { - "type": "integer", - "format": "int64" - }, - "secret": { - "type": "string" - } - } - }, - "endpoint": { - "type": "string" - }, - "engine": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "status": { - "type": "object", - "properties": { - "ping": { - "type": "integer", - "format": "int64" - } - } - } - } - }, - "volume": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "projected": { - "$ref": "#/definitions/projectedVolume" - }, - "pvc": { - "$ref": "#/definitions/pvc" - } - } - } - }, - "securityDefinitions": { - "key": { - "type": "oauth2", - "flow": "accessCode", - "authorizationUrl": "http://min.io", - "tokenUrl": "http://min.io" - } - }, - "security": [ - { - "key": [] - } - ] -}`)) -} diff --git a/operatorapi/k8s_client.go b/operatorapi/k8s_client.go deleted file mode 100644 index cabc821a1..000000000 --- a/operatorapi/k8s_client.go +++ /dev/null @@ -1,114 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - - v1 "k8s.io/api/core/v1" - storagev1 "k8s.io/api/storage/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/kubernetes" -) - -// K8sClientI interface with all functions to be implemented -// by mock when testing, it should include all K8sClientI respective api calls -// that are used within this project. -type K8sClientI interface { - getResourceQuota(ctx context.Context, namespace, resource string, opts metav1.GetOptions) (*v1.ResourceQuota, error) - getNamespace(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Namespace, error) - getStorageClasses(ctx context.Context, opts metav1.ListOptions) (*storagev1.StorageClassList, error) - getSecret(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*v1.Secret, error) - getService(ctx context.Context, namespace, serviceName string, opts metav1.GetOptions) (*v1.Service, error) - deletePodCollection(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - deleteSecret(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error - deleteSecretsCollection(ctx context.Context, namespace string, deleteOpts metav1.DeleteOptions, listOpts metav1.ListOptions) error - createSecret(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) - updateSecret(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.UpdateOptions) (*v1.Secret, error) - getPVC(ctx context.Context, namespace string, pvcName string, opts metav1.GetOptions) (*v1.PersistentVolumeClaim, error) - getConfigMap(ctx context.Context, namespace, configMap string, opts metav1.GetOptions) (*v1.ConfigMap, error) - createConfigMap(ctx context.Context, namespace string, cm *v1.ConfigMap, opts metav1.CreateOptions) (*v1.ConfigMap, error) - updateConfigMap(ctx context.Context, namespace string, cm *v1.ConfigMap, opts metav1.UpdateOptions) (*v1.ConfigMap, error) - deleteConfigMap(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error -} - -// Interface implementation -// -// Define the structure of a k8s client and define the functions that are actually used -type k8sClient struct { - client *kubernetes.Clientset -} - -func (c *k8sClient) getResourceQuota(ctx context.Context, namespace, resource string, opts metav1.GetOptions) (*v1.ResourceQuota, error) { - return c.client.CoreV1().ResourceQuotas(namespace).Get(ctx, resource, opts) -} - -func (c *k8sClient) getSecret(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*v1.Secret, error) { - return c.client.CoreV1().Secrets(namespace).Get(ctx, secretName, opts) -} - -func (c *k8sClient) getService(ctx context.Context, namespace, serviceName string, opts metav1.GetOptions) (*v1.Service, error) { - return c.client.CoreV1().Services(namespace).Get(ctx, serviceName, opts) -} - -func (c *k8sClient) deletePodCollection(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return c.client.CoreV1().Pods(namespace).DeleteCollection(ctx, opts, listOpts) -} - -func (c *k8sClient) deleteSecret(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error { - return c.client.CoreV1().Secrets(namespace).Delete(ctx, name, opts) -} - -func (c *k8sClient) deleteSecretsCollection(ctx context.Context, namespace string, deleteOpts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return c.client.CoreV1().Secrets(namespace).DeleteCollection(ctx, deleteOpts, listOpts) -} - -func (c *k8sClient) createSecret(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) { - return c.client.CoreV1().Secrets(namespace).Create(ctx, secret, opts) -} - -func (c *k8sClient) updateSecret(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.UpdateOptions) (*v1.Secret, error) { - return c.client.CoreV1().Secrets(namespace).Update(ctx, secret, opts) -} - -func (c *k8sClient) getNamespace(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Namespace, error) { - return c.client.CoreV1().Namespaces().Get(ctx, name, opts) -} - -func (c *k8sClient) getStorageClasses(ctx context.Context, opts metav1.ListOptions) (*storagev1.StorageClassList, error) { - return c.client.StorageV1().StorageClasses().List(ctx, opts) -} - -func (c *k8sClient) getPVC(ctx context.Context, namespace string, pvcName string, opts metav1.GetOptions) (*v1.PersistentVolumeClaim, error) { - return c.client.CoreV1().PersistentVolumeClaims(namespace).Get(ctx, pvcName, opts) -} - -func (c *k8sClient) getConfigMap(ctx context.Context, namespace, name string, opts metav1.GetOptions) (*v1.ConfigMap, error) { - return c.client.CoreV1().ConfigMaps(namespace).Get(ctx, name, opts) -} - -func (c *k8sClient) createConfigMap(ctx context.Context, namespace string, cm *v1.ConfigMap, opts metav1.CreateOptions) (*v1.ConfigMap, error) { - return c.client.CoreV1().ConfigMaps(namespace).Create(ctx, cm, opts) -} - -func (c *k8sClient) updateConfigMap(ctx context.Context, namespace string, cm *v1.ConfigMap, opts metav1.UpdateOptions) (*v1.ConfigMap, error) { - return c.client.CoreV1().ConfigMaps(namespace).Update(ctx, cm, opts) -} - -func (c *k8sClient) deleteConfigMap(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error { - return c.client.CoreV1().ConfigMaps(namespace).Delete(ctx, name, opts) -} diff --git a/operatorapi/k8s_client_mock.go b/operatorapi/k8s_client_mock.go deleted file mode 100644 index 1b0717870..000000000 --- a/operatorapi/k8s_client_mock.go +++ /dev/null @@ -1,103 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - - corev1 "k8s.io/api/core/v1" - v1 "k8s.io/api/core/v1" - storagev1 "k8s.io/api/storage/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -type k8sClientMock struct{} - -var ( - k8sClientGetResourceQuotaMock func(ctx context.Context, namespace, resource string, opts metav1.GetOptions) (*v1.ResourceQuota, error) - k8sClientGetNameSpaceMock func(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Namespace, error) - k8sClientStorageClassesMock func(ctx context.Context, opts metav1.ListOptions) (*storagev1.StorageClassList, error) - - k8sClientGetConfigMapMock func(ctx context.Context, namespace, configMap string, opts metav1.GetOptions) (*corev1.ConfigMap, error) - k8sClientCreateConfigMapMock func(ctx context.Context, namespace string, cm *corev1.ConfigMap, opts metav1.CreateOptions) (*corev1.ConfigMap, error) - k8sClientUpdateConfigMapMock func(ctx context.Context, namespace string, cm *corev1.ConfigMap, opts metav1.UpdateOptions) (*corev1.ConfigMap, error) - k8sClientDeleteConfigMapMock func(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error - - k8sClientDeletePodCollectionMock func(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - k8sClientDeleteSecretMock func(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error - k8sClientDeleteSecretsCollectionMock func(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - k8sClientCreateSecretMock func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) - k8sClientUpdateSecretMock func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.UpdateOptions) (*v1.Secret, error) - k8sclientGetSecretMock func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) - k8sclientGetServiceMock func(ctx context.Context, namespace, serviceName string, opts metav1.GetOptions) (*corev1.Service, error) -) - -func (c k8sClientMock) getResourceQuota(ctx context.Context, namespace, resource string, opts metav1.GetOptions) (*v1.ResourceQuota, error) { - return k8sClientGetResourceQuotaMock(ctx, namespace, resource, opts) -} - -func (c k8sClientMock) getNamespace(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Namespace, error) { - return k8sClientGetNameSpaceMock(ctx, name, opts) -} - -func (c k8sClientMock) getStorageClasses(ctx context.Context, opts metav1.ListOptions) (*storagev1.StorageClassList, error) { - return k8sClientStorageClassesMock(ctx, opts) -} - -func (c k8sClientMock) getConfigMap(ctx context.Context, namespace, configMap string, opts metav1.GetOptions) (*corev1.ConfigMap, error) { - return k8sClientGetConfigMapMock(ctx, namespace, configMap, opts) -} - -func (c k8sClientMock) createConfigMap(ctx context.Context, namespace string, cm *corev1.ConfigMap, opts metav1.CreateOptions) (*corev1.ConfigMap, error) { - return k8sClientCreateConfigMapMock(ctx, namespace, cm, opts) -} - -func (c k8sClientMock) updateConfigMap(ctx context.Context, namespace string, cm *corev1.ConfigMap, opts metav1.UpdateOptions) (*corev1.ConfigMap, error) { - return k8sClientUpdateConfigMapMock(ctx, namespace, cm, opts) -} - -func (c k8sClientMock) deleteConfigMap(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error { - return k8sClientDeleteConfigMapMock(ctx, namespace, name, opts) -} - -func (c k8sClientMock) deletePodCollection(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return k8sClientDeletePodCollectionMock(ctx, namespace, opts, listOpts) -} - -func (c k8sClientMock) deleteSecret(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error { - return k8sClientDeleteSecretMock(ctx, namespace, name, opts) -} - -func (c k8sClientMock) deleteSecretsCollection(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return k8sClientDeleteSecretsCollectionMock(ctx, namespace, opts, listOpts) -} - -func (c k8sClientMock) createSecret(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) { - return k8sClientCreateSecretMock(ctx, namespace, secret, opts) -} - -func (c k8sClientMock) updateSecret(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.UpdateOptions) (*v1.Secret, error) { - return k8sClientUpdateSecretMock(ctx, namespace, secret, opts) -} - -func (c k8sClientMock) getSecret(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return k8sclientGetSecretMock(ctx, namespace, secretName, opts) -} - -func (c k8sClientMock) getService(ctx context.Context, namespace, serviceName string, opts metav1.GetOptions) (*corev1.Service, error) { - return k8sclientGetServiceMock(ctx, namespace, serviceName, opts) -} diff --git a/operatorapi/login.go b/operatorapi/login.go deleted file mode 100644 index c328be4ee..000000000 --- a/operatorapi/login.go +++ /dev/null @@ -1,243 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "encoding/base64" - "encoding/json" - "fmt" - "math/rand" - "net/http" - - xoauth2 "golang.org/x/oauth2" - - "github.com/minio/minio-go/v7/pkg/credentials" - "github.com/minio/pkg/env" - - "github.com/minio/console/restapi" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/models" - opauth "github.com/minio/console/operatorapi/auth" - "github.com/minio/console/operatorapi/operations" - authApi "github.com/minio/console/operatorapi/operations/auth" - - "github.com/minio/console/pkg/auth" - "github.com/minio/console/pkg/auth/idp/oauth2" -) - -func registerLoginHandlers(api *operations.OperatorAPI) { - // GET login strategy - api.AuthLoginDetailHandler = authApi.LoginDetailHandlerFunc(func(params authApi.LoginDetailParams) middleware.Responder { - loginDetails, err := getLoginDetailsResponse(params) - if err != nil { - return authApi.NewLoginDetailDefault(int(err.Code)).WithPayload(err) - } - return authApi.NewLoginDetailOK().WithPayload(loginDetails) - }) - // POST login using k8s service account token - api.AuthLoginOperatorHandler = authApi.LoginOperatorHandlerFunc(func(params authApi.LoginOperatorParams) middleware.Responder { - loginResponse, err := getLoginOperatorResponse(params) - if err != nil { - return authApi.NewLoginOperatorDefault(int(err.Code)).WithPayload(err) - } - // Custom response writer to set the session cookies - return middleware.ResponderFunc(func(w http.ResponseWriter, p runtime.Producer) { - cookie := restapi.NewSessionCookieForConsole(loginResponse.SessionID) - http.SetCookie(w, &cookie) - authApi.NewLoginOperatorNoContent().WriteResponse(w, p) - }) - }) - // POST login using external IDP - api.AuthLoginOauth2AuthHandler = authApi.LoginOauth2AuthHandlerFunc(func(params authApi.LoginOauth2AuthParams) middleware.Responder { - loginResponse, err := getLoginOauth2AuthResponse(params) - if err != nil { - return authApi.NewLoginOauth2AuthDefault(int(err.Code)).WithPayload(err) - } - // Custom response writer to set the session cookies - return middleware.ResponderFunc(func(w http.ResponseWriter, p runtime.Producer) { - cookie := restapi.NewSessionCookieForConsole(loginResponse.SessionID) - http.SetCookie(w, &cookie) - authApi.NewLoginOauth2AuthNoContent().WriteResponse(w, p) - }) - }) -} - -// login performs a check of consoleCredentials against MinIO, generates some claims and returns the jwt -// for subsequent authentication -func login(credentials restapi.ConsoleCredentialsI) (*string, error) { - // try to obtain consoleCredentials, - tokens, err := credentials.Get() - if err != nil { - return nil, err - } - // if we made it here, the consoleCredentials work, generate a jwt with claims - token, err := auth.NewEncryptedTokenForClient(&tokens, credentials.GetAccountAccessKey(), nil) - if err != nil { - restapi.LogError("error authenticating user: %v", err) - return nil, restapi.ErrInvalidLogin - } - return &token, nil -} - -// isKubernetes returns true if minio is running in kubernetes. -func isKubernetes() bool { - // Kubernetes env used to validate if we are - // indeed running inside a kubernetes pod - // is KUBERNETES_SERVICE_HOST - // https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/kubelet_pods.go#L541 - return env.Get("KUBERNETES_SERVICE_HOST", "") != "" -} - -// getLoginDetailsResponse returns information regarding the Console authentication mechanism. -func getLoginDetailsResponse(params authApi.LoginDetailParams) (*models.LoginDetails, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - r := params.HTTPRequest - - loginStrategy := models.LoginDetailsLoginStrategyServiceDashAccount - - var redirectRules []*models.RedirectRule - - if oauth2.IsIDPEnabled() { - loginStrategy = models.LoginDetailsLoginStrategyRedirectDashServiceDashAccount - // initialize new oauth2 client - oauth2Client, err := oauth2.NewOauth2ProviderClient(nil, r, restapi.GetConsoleHTTPClient("")) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - // Validate user against IDP - identityProvider := &auth.IdentityProvider{ - KeyFunc: oauth2.DefaultDerivedKey, - Client: oauth2Client, - } - - newRedirectRule := &models.RedirectRule{ - Redirect: identityProvider.GenerateLoginURL(), - DisplayName: "Login with SSO", - } - - redirectRules = append(redirectRules, newRedirectRule) - } - - loginDetails := &models.LoginDetails{ - LoginStrategy: loginStrategy, - RedirectRules: redirectRules, - IsDirectPV: getDirectPVEnabled(), - IsK8S: isKubernetes(), - } - return loginDetails, nil -} - -// verifyUserAgainstIDP will verify user identity against the configured IDP and return MinIO credentials -func verifyUserAgainstIDP(ctx context.Context, provider auth.IdentityProviderI, code, state string) (*xoauth2.Token, error) { - oauth2Token, err := provider.VerifyIdentityForOperator(ctx, code, state) - if err != nil { - return nil, err - } - return oauth2Token, nil -} - -func getLoginOauth2AuthResponse(params authApi.LoginOauth2AuthParams) (*models.LoginResponse, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - r := params.HTTPRequest - lr := params.Body - - if oauth2.IsIDPEnabled() { - decodedRState, err := base64.StdEncoding.DecodeString(*lr.State) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - - var requestItems oauth2.LoginURLParams - err = json.Unmarshal(decodedRState, &requestItems) - - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - - // initialize new oauth2 client - oauth2Client, err := oauth2.NewOauth2ProviderClient(nil, r, restapi.GetConsoleHTTPClient("")) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - // initialize new identity provider - identityProvider := auth.IdentityProvider{ - KeyFunc: oauth2.DefaultDerivedKey, - Client: oauth2Client, - } - // Validate user against IDP - _, err = verifyUserAgainstIDP(ctx, identityProvider, *lr.Code, requestItems.State) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - // If we pass here that means the IDP correctly authenticate the user with the operator resource - // we proceed to use the service account token configured in the operator-console pod - creds, err := newConsoleCredentials(getK8sSAToken()) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - token, err := login(restapi.ConsoleCredentials{ConsoleCredentials: creds}) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, restapi.ErrInvalidLogin, nil, err) - } - // serialize output - loginResponse := &models.LoginResponse{ - SessionID: *token, - } - return loginResponse, nil - } - return nil, restapi.ErrorWithContext(ctx, restapi.ErrDefault) -} - -func newConsoleCredentials(secretKey string) (*credentials.Credentials, error) { - creds, err := opauth.GetConsoleCredentialsForOperator(secretKey) - if err != nil { - return nil, err - } - return creds, nil -} - -// getLoginOperatorResponse validate the provided service account token against k8s api -func getLoginOperatorResponse(params authApi.LoginOperatorParams) (*models.LoginResponse, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - lmr := params.Body - - creds, err := newConsoleCredentials(*lmr.Jwt) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - consoleCreds := restapi.ConsoleCredentials{ConsoleCredentials: creds} - // Set a random as access key as session identifier - consoleCreds.AccountAccessKey = fmt.Sprintf("%d", rand.Intn(100000-10000)+10000) - token, err := login(consoleCreds) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, restapi.ErrInvalidLogin, nil, err) - } - // serialize output - loginResponse := &models.LoginResponse{ - SessionID: *token, - } - return loginResponse, nil -} diff --git a/operatorapi/logout.go b/operatorapi/logout.go deleted file mode 100644 index 3d1552ed5..000000000 --- a/operatorapi/logout.go +++ /dev/null @@ -1,42 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "net/http" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations" - authApi "github.com/minio/console/operatorapi/operations/auth" - "github.com/minio/console/restapi" -) - -func registerLogoutHandlers(api *operations.OperatorAPI) { - // logout from console - api.AuthLogoutHandler = authApi.LogoutHandlerFunc(func(params authApi.LogoutParams, session *models.Principal) middleware.Responder { - // Custom response writer to expire the session cookies - return middleware.ResponderFunc(func(w http.ResponseWriter, p runtime.Producer) { - expiredCookie := restapi.ExpireSessionCookie() - // this will tell the browser to clear the cookie and invalidate user session - // additionally we are deleting the cookie from the client side - http.SetCookie(w, &expiredCookie) - authApi.NewLogoutOK().WriteResponse(w, p) - }) - }) -} diff --git a/operatorapi/logs.go b/operatorapi/logs.go deleted file mode 100644 index 6dd509152..000000000 --- a/operatorapi/logs.go +++ /dev/null @@ -1,78 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operatorapi - -import ( - "errors" - "log" - "os" - - "github.com/minio/cli" -) - -var ( - infoLog = log.New(os.Stdout, "I: ", log.LstdFlags) - errorLog = log.New(os.Stdout, "E: ", log.LstdFlags) -) - -func logInfo(msg string, data ...interface{}) { - infoLog.Printf(msg+"\n", data...) -} - -func logError(msg string, data ...interface{}) { - errorLog.Printf(msg+"\n", data...) -} - -// globally changeable logger styles -var ( - LogInfo = logInfo - LogError = logError -) - -// Context captures all command line flags values -type Context struct { - Host string - HTTPPort, HTTPSPort int - TLSRedirect string - // Legacy options, TODO: remove in future - TLSCertificate, TLSKey, TLSca string -} - -// Load loads restapi Context from command line context. -func (c *Context) Load(ctx *cli.Context) error { - *c = Context{ - Host: ctx.String("host"), - HTTPPort: ctx.Int("port"), - HTTPSPort: ctx.Int("tls-port"), - TLSRedirect: ctx.String("tls-redirect"), - // Legacy options to be removed. - TLSCertificate: ctx.String("tls-certificate"), - TLSKey: ctx.String("tls-key"), - TLSca: ctx.String("tls-ca"), - } - if c.HTTPPort > 65535 { - return errors.New("invalid argument --port out of range - ports can range from 1-65535") - } - if c.HTTPSPort > 65535 { - return errors.New("invalid argument --tls-port out of range - ports can range from 1-65535") - } - if c.TLSRedirect != "on" && c.TLSRedirect != "off" { - return errors.New("invalid argument --tls-redirect only accepts either 'on' or 'off'") - } - return nil -} diff --git a/operatorapi/logs_test.go b/operatorapi/logs_test.go deleted file mode 100644 index bfc863d2e..000000000 --- a/operatorapi/logs_test.go +++ /dev/null @@ -1,110 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2022 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "flag" - "fmt" - "testing" - - "github.com/minio/cli" - "github.com/stretchr/testify/assert" -) - -func TestContext_Load(t *testing.T) { - type fields struct { - Host string - HTTPPort int - HTTPSPort int - TLSRedirect string - TLSCertificate string - TLSKey string - TLSca string - } - type args struct { - values map[string]string - } - tests := []struct { - name string - fields fields - args args - wantErr bool - }{ - { - name: "valid args", - args: args{ - values: map[string]string{ - "tls-redirect": "on", - }, - }, - wantErr: false, - }, - { - name: "invalid args", - args: args{ - values: map[string]string{ - "tls-redirect": "aaaa", - }, - }, - wantErr: true, - }, - { - name: "invalid port http", - args: args{ - values: map[string]string{ - "tls-redirect": "on", - "port": "65536", - }, - }, - wantErr: true, - }, - { - name: "invalid port https", - args: args{ - values: map[string]string{ - "tls-redirect": "on", - "port": "65534", - "tls-port": "65536", - }, - }, - wantErr: true, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - c := &Context{} - - fs := flag.NewFlagSet("flags", flag.ContinueOnError) - for k, v := range tt.args.values { - fs.String(k, v, "ok") - } - - ctx := cli.NewContext(nil, fs, &cli.Context{}) - - err := c.Load(ctx) - if tt.wantErr { - assert.NotNilf(t, err, fmt.Sprintf("Load(%v)", err)) - } else { - assert.Nilf(t, err, fmt.Sprintf("Load(%v)", err)) - } - }) - } -} - -func Test_logInfo(t *testing.T) { - logInfo("message", nil) -} diff --git a/operatorapi/marketplace.go b/operatorapi/marketplace.go deleted file mode 100644 index a35bbc9c6..000000000 --- a/operatorapi/marketplace.go +++ /dev/null @@ -1,196 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2022 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "fmt" - "io" - "net/http" - "os" - "strings" - "time" - - "github.com/go-openapi/runtime/middleware" - "github.com/golang-jwt/jwt/v4" - "github.com/minio/console/cluster" - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations" - "github.com/minio/console/operatorapi/operations/operator_api" - "github.com/minio/console/pkg" - "github.com/minio/console/restapi" - errors "github.com/minio/console/restapi" - "github.com/minio/pkg/env" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -var ( - mpConfigMapDefault = "mp-config" - mpConfigMapKey = "MP_CONFIG_KEY" - mpHostEnvVar = "MP_HOST" - defaultMPHost = "https://marketplace.apps.min.dev" - mpEUHostEnvVar = "MP_EU_HOST" - defaultEUMPHost = "https://marketplace-eu.apps.min.dev" - isMPEmailSet = "isEmailSet" - emailNotSetMsg = "Email was not sent in request" -) - -func registerMarketplaceHandlers(api *operations.OperatorAPI) { - api.OperatorAPIGetMPIntegrationHandler = operator_api.GetMPIntegrationHandlerFunc(func(params operator_api.GetMPIntegrationParams, session *models.Principal) middleware.Responder { - payload, err := getMPIntegrationResponse(session, params) - if err != nil { - return operator_api.NewGetMPIntegrationDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewGetMPIntegrationOK().WithPayload(payload) - }) - - api.OperatorAPIPostMPIntegrationHandler = operator_api.PostMPIntegrationHandlerFunc(func(params operator_api.PostMPIntegrationParams, session *models.Principal) middleware.Responder { - err := postMPIntegrationResponse(session, params) - if err != nil { - return operator_api.NewPostMPIntegrationDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewPostMPIntegrationCreated() - }) -} - -func getMPIntegrationResponse(session *models.Principal, params operator_api.GetMPIntegrationParams) (*operator_api.GetMPIntegrationOKBody, *models.Error) { - clientSet, err := cluster.K8sClient(session.STSSessionToken) - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - if err != nil { - return nil, errors.ErrorWithContext(ctx, err) - } - isMPEmailSet, err := getMPEmail(ctx, &k8sClient{client: clientSet}) - if err != nil { - return nil, errors.ErrorWithContext(ctx, errors.ErrNotFound) - } - return &operator_api.GetMPIntegrationOKBody{ - IsEmailSet: isMPEmailSet, - }, nil -} - -func getMPEmail(ctx context.Context, clientSet K8sClientI) (bool, error) { - cm, err := clientSet.getConfigMap(ctx, "default", getMPConfigMapKey(mpConfigMapKey), metav1.GetOptions{}) - if err != nil { - return false, err - } - return cm.Data[isMPEmailSet] == "true", nil -} - -func postMPIntegrationResponse(session *models.Principal, params operator_api.PostMPIntegrationParams) *models.Error { - clientSet, err := cluster.K8sClient(session.STSSessionToken) - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - if err != nil { - return errors.ErrorWithContext(ctx, err) - } - return setMPIntegration(ctx, params.Body.Email, params.Body.IsInEU, &k8sClient{client: clientSet}) -} - -func setMPIntegration(ctx context.Context, email string, isInEU bool, clientSet K8sClientI) *models.Error { - if email == "" { - return errors.ErrorWithContext(ctx, errors.ErrBadRequest, fmt.Errorf(emailNotSetMsg)) - } - if _, err := setMPEmail(ctx, email, isInEU, clientSet); err != nil { - return errors.ErrorWithContext(ctx, err) - } - return nil -} - -func setMPEmail(ctx context.Context, email string, isInEU bool, clientSet K8sClientI) (*corev1.ConfigMap, error) { - if err := postEmailToMP(email, isInEU); err != nil { - return nil, err - } - cm := createCM() - return clientSet.createConfigMap(ctx, "default", cm, metav1.CreateOptions{}) -} - -func postEmailToMP(email string, isInEU bool) error { - mpURL, err := getMPURL(isInEU) - if err != nil { - return err - } - return makePostRequestToMP(mpURL, email) -} - -func getMPURL(isInEU bool) (string, error) { - mpHost := getMPHost(isInEU) - if mpHost == "" { - return "", fmt.Errorf("mp host not set") - } - return fmt.Sprintf("%s/mp-email", mpHost), nil -} - -func getMPHost(isInEU bool) string { - if isInEU { - return env.Get(mpEUHostEnvVar, defaultEUMPHost) - } - return env.Get(mpHostEnvVar, defaultMPHost) -} - -func makePostRequestToMP(url, email string) error { - request, err := createMPRequest(url, email) - if err != nil { - return err - } - client := restapi.GetConsoleHTTPClient("") - client.Timeout = 3 * time.Second - if res, err := client.Do(request); err != nil { - return err - } else if res.StatusCode >= http.StatusBadRequest { - b, _ := io.ReadAll(res.Body) - return fmt.Errorf("request to %s failed with status code %d and error %s", url, res.StatusCode, string(b)) - } - return nil -} - -func createMPRequest(url, email string) (*http.Request, error) { - request, err := http.NewRequest("POST", url, strings.NewReader(fmt.Sprintf("{\"email\":\"%s\"}", email))) - if err != nil { - return nil, err - } - jwtToken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{}) - jwtTokenString, err := jwtToken.SignedString([]byte(pkg.MPSecret)) - if err != nil { - return nil, err - } - request.Header.Add("Cookie", fmt.Sprintf("jwtToken=%s", jwtTokenString)) - request.Header.Add("Content-Type", "application/json") - return request, nil -} - -func createCM() *corev1.ConfigMap { - return &corev1.ConfigMap{ - TypeMeta: metav1.TypeMeta{ - Kind: "ConfigMap", - APIVersion: "v1", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: getMPConfigMapKey(mpConfigMapKey), - Namespace: "default", - }, - Data: map[string]string{isMPEmailSet: "true"}, - } -} - -func getMPConfigMapKey(envVar string) string { - if mp := os.Getenv(envVar); mp != "" { - return mp - } - return mpConfigMapDefault -} diff --git a/operatorapi/marketplace_test.go b/operatorapi/marketplace_test.go deleted file mode 100644 index ef1cbd265..000000000 --- a/operatorapi/marketplace_test.go +++ /dev/null @@ -1,194 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2022 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "errors" - "fmt" - "net/http" - "net/http/httptest" - "os" - "testing" - - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations" - "github.com/minio/console/operatorapi/operations/operator_api" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/suite" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -var ( - testWithError = false - testServerWithError = false - errMock = errors.New("mock error") -) - -type MarketplaceTestSuite struct { - suite.Suite - assert *assert.Assertions - kClient k8sClientMock - namespace string - postServer *httptest.Server -} - -func (suite *MarketplaceTestSuite) SetupSuite() { - suite.assert = assert.New(suite.T()) - suite.namespace = "default" - k8sClientGetConfigMapMock = suite.getConfigMapMock - k8sClientCreateConfigMapMock = suite.createConfigMapMock - k8sClientUpdateConfigMapMock = suite.updateConfigMapMock - k8sClientDeleteConfigMapMock = suite.deleteConfigMapMock - os.Setenv(mpConfigMapKey, "mp-mock-config") - suite.postServer = httptest.NewServer(http.HandlerFunc(suite.postHandler)) -} - -func (suite *MarketplaceTestSuite) postHandler( - w http.ResponseWriter, r *http.Request, -) { - if testServerWithError { - w.WriteHeader(400) - } else { - fmt.Fprintf(w, `{"post": "Post response"}`) - } -} - -func (suite *MarketplaceTestSuite) TearDownSuite() { - os.Unsetenv(mpConfigMapKey) -} - -func (suite *MarketplaceTestSuite) getConfigMapMock(ctx context.Context, namespace, configMap string, opts metav1.GetOptions) (*corev1.ConfigMap, error) { - if testWithError { - return nil, errMock - } - return &corev1.ConfigMap{Data: map[string]string{isMPEmailSet: "true"}}, nil -} - -func (suite *MarketplaceTestSuite) createConfigMapMock(ctx context.Context, namespace string, cm *corev1.ConfigMap, opts metav1.CreateOptions) (*corev1.ConfigMap, error) { - if testWithError { - return nil, errMock - } - return &corev1.ConfigMap{}, nil -} - -func (suite *MarketplaceTestSuite) updateConfigMapMock(ctx context.Context, namespace string, cm *corev1.ConfigMap, opts metav1.UpdateOptions) (*corev1.ConfigMap, error) { - if testWithError { - return nil, errMock - } - return &corev1.ConfigMap{}, nil -} - -func (suite *MarketplaceTestSuite) deleteConfigMapMock(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error { - if testWithError { - return errMock - } - return nil -} - -func (suite *MarketplaceTestSuite) TestRegisterMarketplaceHandlers() { - api := &operations.OperatorAPI{} - suite.assert.Nil(api.OperatorAPIGetMPIntegrationHandler) - suite.assert.Nil(api.OperatorAPIPostMPIntegrationHandler) - registerMarketplaceHandlers(api) - suite.assert.NotNil(api.OperatorAPIGetMPIntegrationHandler) - suite.assert.NotNil(api.OperatorAPIPostMPIntegrationHandler) -} - -func (suite *MarketplaceTestSuite) TestGetMPIntegrationHandlerWithError() { - api := &operations.OperatorAPI{} - registerMarketplaceHandlers(api) - params := operator_api.NewGetMPIntegrationParams() - params.HTTPRequest = &http.Request{} - response := api.OperatorAPIGetMPIntegrationHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.GetMPIntegrationDefault) - suite.assert.True(ok) -} - -func (suite *MarketplaceTestSuite) TestPostMPIntegrationHandlerWithError() { - api := &operations.OperatorAPI{} - registerMarketplaceHandlers(api) - params := operator_api.NewPostMPIntegrationParams() - params.Body = &models.MpIntegration{Email: ""} - params.HTTPRequest = &http.Request{} - params.HTTPRequest.Header = map[string][]string{} - params.HTTPRequest.AddCookie(&http.Cookie{Value: "token", Name: "token"}) - response := api.OperatorAPIPostMPIntegrationHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.PostMPIntegrationDefault) - suite.assert.True(ok) -} - -func (suite *MarketplaceTestSuite) TestGetMPEmailWithError() { - testWithError = true - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - email, err := getMPEmail(ctx, &suite.kClient) - suite.assert.NotNil(err) - suite.assert.Empty(email) -} - -func (suite *MarketplaceTestSuite) TestGetMPEmailNoError() { - testWithError = false - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - isSet, err := getMPEmail(ctx, &suite.kClient) - suite.assert.Nil(err) - suite.assert.True(isSet) -} - -func (suite *MarketplaceTestSuite) TestSetMPIntegrationNoEmail() { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - err := setMPIntegration(ctx, "", false, &suite.kClient) - suite.assert.NotNil(err) -} - -func (suite *MarketplaceTestSuite) TestSetMPIntegrationWithError() { - testWithError = true - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - os.Setenv(mpHostEnvVar, " ") - err := setMPIntegration(ctx, "mock@mock.com", false, &suite.kClient) - suite.assert.NotNil(err) - os.Unsetenv(mpHostEnvVar) -} - -func (suite *MarketplaceTestSuite) TestSetMPIntegrationNoError() { - testWithError = false - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - os.Setenv(mpHostEnvVar, suite.postServer.URL) - err := setMPIntegration(ctx, "mock@mock.com", false, &suite.kClient) - suite.assert.Nil(err) - os.Unsetenv(mpHostEnvVar) -} - -func (suite *MarketplaceTestSuite) TestSetMPIntegrationWithRequestError() { - testWithError = false - testServerWithError = true - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - os.Setenv(mpHostEnvVar, suite.postServer.URL) - err := setMPIntegration(ctx, "mock@mock.com", false, &suite.kClient) - suite.assert.NotNil(err) - os.Unsetenv(mpHostEnvVar) -} - -func TestMarketplace(t *testing.T) { - suite.Run(t, new(MarketplaceTestSuite)) -} diff --git a/operatorapi/minio_operator_mock.go b/operatorapi/minio_operator_mock.go deleted file mode 100644 index 3592903f9..000000000 --- a/operatorapi/minio_operator_mock.go +++ /dev/null @@ -1,45 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -type ( - opClientMock struct{} - httpClientMock struct{} - directPVDriveMock struct{} - directPVVolumeMock struct{} -) - -func createMockPVC(pvcMockName, pvcMockNamespace string) *v1.PersistentVolumeClaim { - var mockVolumeMode v1.PersistentVolumeMode = "mockVolumeMode" - mockStorage := "mockStorage" - - return &v1.PersistentVolumeClaim{ - ObjectMeta: metav1.ObjectMeta{ - Name: pvcMockName, - Namespace: pvcMockNamespace, - }, - Spec: v1.PersistentVolumeClaimSpec{ - StorageClassName: &mockStorage, - VolumeMode: &mockVolumeMode, - }, - } -} diff --git a/operatorapi/namespaces.go b/operatorapi/namespaces.go deleted file mode 100644 index 140f8f877..000000000 --- a/operatorapi/namespaces.go +++ /dev/null @@ -1,82 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "errors" - - xerrors "github.com/minio/console/restapi" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/cluster" - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations" - "github.com/minio/console/operatorapi/operations/operator_api" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - v1 "k8s.io/client-go/kubernetes/typed/core/v1" -) - -func registerNamespaceHandlers(api *operations.OperatorAPI) { - // Add Namespace - // api.OperatorAPICreateNamespaceHandler = operator_api.CreateNamespaceHandlerFunc(func(params operator_api.CreateNamespaceParams, session *models.Principal) middleware.Responder { - api.OperatorAPICreateNamespaceHandler = operator_api.CreateNamespaceHandlerFunc(func(params operator_api.CreateNamespaceParams, session *models.Principal) middleware.Responder { - err := getNamespaceCreatedResponse(session, params) - if err != nil { - return operator_api.NewCreateNamespaceDefault(int(err.Code)).WithPayload(err) - } - return nil - }) -} - -func getNamespaceCreatedResponse(session *models.Principal, params operator_api.CreateNamespaceParams) *models.Error { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - clientset, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return xerrors.ErrorWithContext(ctx, err) - } - - namespace := *params.Body.Name - - errCreation := getNamespaceCreated(ctx, clientset.CoreV1(), namespace) - - if errCreation != nil { - return xerrors.ErrorWithContext(ctx, errCreation) - } - - return nil -} - -func getNamespaceCreated(ctx context.Context, clientset v1.CoreV1Interface, namespace string) error { - if namespace == "" { - errNS := errors.New("Namespace cannot be blank") - - return errNS - } - - coreNamespace := corev1.Namespace{ - ObjectMeta: metav1.ObjectMeta{ - Name: namespace, - }, - } - - _, err := clientset.Namespaces().Create(ctx, &coreNamespace, metav1.CreateOptions{}) - - return err -} diff --git a/operatorapi/namespaces_test.go b/operatorapi/namespaces_test.go deleted file mode 100644 index 01448a8d4..000000000 --- a/operatorapi/namespaces_test.go +++ /dev/null @@ -1,63 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "testing" - - "k8s.io/client-go/kubernetes/fake" -) - -func Test_CreateNamespace(t *testing.T) { - type args struct { - ctx context.Context - namespace string - } - tests := []struct { - name string - args args - wantErr bool - }{ - { - name: "Namespace created successfully", - args: args{ - ctx: context.Background(), - namespace: "ns-test", - }, - wantErr: false, - }, - { - // Description: If the namespace is blank, an error should be returned - name: "Namespace creation failed", - args: args{ - ctx: context.Background(), - namespace: "", - }, - wantErr: true, - }, - } - for _, tt := range tests { - kubeClient := fake.NewSimpleClientset() - t.Run(tt.name, func(t *testing.T) { - err := getNamespaceCreated(tt.args.ctx, kubeClient.CoreV1(), tt.args.namespace) - if (err != nil) != tt.wantErr { - t.Errorf("getNamespaceCreated() error = %v, wantErr %v", err, tt.wantErr) - } - }) - } -} diff --git a/operatorapi/nodes.go b/operatorapi/nodes.go deleted file mode 100644 index d8d313890..000000000 --- a/operatorapi/nodes.go +++ /dev/null @@ -1,373 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "errors" - "sort" - - xerrors "github.com/minio/console/restapi" - - "github.com/minio/minio-go/v7/pkg/set" - - "github.com/minio/console/operatorapi/operations/operator_api" - - "github.com/minio/console/cluster" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - v1 "k8s.io/client-go/kubernetes/typed/core/v1" -) - -func registerNodesHandlers(api *operations.OperatorAPI) { - api.OperatorAPIGetMaxAllocatableMemHandler = operator_api.GetMaxAllocatableMemHandlerFunc(func(params operator_api.GetMaxAllocatableMemParams, principal *models.Principal) middleware.Responder { - resp, err := getMaxAllocatableMemoryResponse(params.HTTPRequest.Context(), principal, params.NumNodes) - if err != nil { - return operator_api.NewGetMaxAllocatableMemDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewGetMaxAllocatableMemOK().WithPayload(resp) - }) - - api.OperatorAPIListNodeLabelsHandler = operator_api.ListNodeLabelsHandlerFunc(func(params operator_api.ListNodeLabelsParams, principal *models.Principal) middleware.Responder { - resp, err := getNodeLabelsResponse(params.HTTPRequest.Context(), principal) - if err != nil { - return operator_api.NewListNodeLabelsDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewListNodeLabelsOK().WithPayload(*resp) - }) - - api.OperatorAPIGetAllocatableResourcesHandler = operator_api.GetAllocatableResourcesHandlerFunc(func(params operator_api.GetAllocatableResourcesParams, session *models.Principal) middleware.Responder { - resp, err := getAllocatableResourcesResponse(session, params) - if err != nil { - return operator_api.NewGetAllocatableResourcesDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewGetAllocatableResourcesOK().WithPayload(resp) - }) -} - -type NodeResourceInfo struct { - Name string - AllocatableMemory int64 - AllocatableCPU int64 -} - -// getMaxAllocatableMemory get max allocatable memory given a desired number of nodes -func getMaxAllocatableMemory(ctx context.Context, clientset v1.CoreV1Interface, numNodes int32) (*models.MaxAllocatableMemResponse, error) { - // can't request less than 4 nodes - if numNodes < 4 { - return nil, xerrors.ErrFewerThanFourNodes - } - - // get all nodes from cluster - nodes, err := clientset.Nodes().List(ctx, metav1.ListOptions{}) - if err != nil { - return nil, err - } - - // requesting more nodes than are schedulable in the cluster - schedulableNodes := len(nodes.Items) - nonMasterNodes := len(nodes.Items) - for _, node := range nodes.Items { - // check taints to check if node is schedulable - for _, taint := range node.Spec.Taints { - if taint.Effect == corev1.TaintEffectNoSchedule { - schedulableNodes-- - } - // check if the node is a master - if taint.Key == "node-role.kubernetes.io/master" { - nonMasterNodes-- - } - } - } - // requesting more nodes than schedulable and less than total number of workers - if int(numNodes) > schedulableNodes && int(numNodes) < nonMasterNodes { - return nil, xerrors.ErrTooManyNodes - } - if nonMasterNodes < int(numNodes) { - return nil, xerrors.ErrTooFewNodes - } - - // not enough schedulable nodes - if schedulableNodes < int(numNodes) { - return nil, xerrors.ErrTooFewAvailableNodes - } - - availableMemSizes := []int64{} -OUTER: - for _, n := range nodes.Items { - // Don't consider node if it has a NoSchedule or NoExecute Taint - for _, t := range n.Spec.Taints { - switch t.Effect { - case corev1.TaintEffectNoSchedule: - continue OUTER - case corev1.TaintEffectNoExecute: - continue OUTER - default: - continue - } - } - if quantity, ok := n.Status.Allocatable[corev1.ResourceMemory]; ok { - availableMemSizes = append(availableMemSizes, quantity.Value()) - } - } - - maxAllocatableMemory := getMaxClusterMemory(numNodes, availableMemSizes) - - res := &models.MaxAllocatableMemResponse{ - MaxMemory: maxAllocatableMemory, - } - - return res, nil -} - -// getMaxClusterMemory returns the maximum memory size that can be used -// across numNodes (number of nodes) -func getMaxClusterMemory(numNodes int32, nodesMemorySizes []int64) int64 { - if int32(len(nodesMemorySizes)) < numNodes || numNodes == 0 { - return 0 - } - - // sort nodesMemorySizes int64 array - sort.Slice(nodesMemorySizes, func(i, j int) bool { return nodesMemorySizes[i] < nodesMemorySizes[j] }) - maxIndex := 0 - maxAllocatableMemory := nodesMemorySizes[maxIndex] - - for i, size := range nodesMemorySizes { - // maxAllocatableMemory is the minimum value of nodesMemorySizes array - // only within the size of numNodes, if more nodes are available - // then the maxAllocatableMemory is equal to the next minimum value - // on the sorted nodesMemorySizes array. - // e.g. with numNodes = 4; - // maxAllocatableMemory of [2,4,8,8] => 2 - // maxAllocatableMemory of [2,4,8,8,16] => 4 - if int32(i) < numNodes { - maxAllocatableMemory = min(maxAllocatableMemory, size) - } else { - maxIndex++ - maxAllocatableMemory = nodesMemorySizes[maxIndex] - } - } - return maxAllocatableMemory -} - -// min returns the smaller of x or y. -func min(x, y int64) int64 { - if x > y { - return y - } - return x -} - -func getMaxAllocatableMemoryResponse(ctx context.Context, session *models.Principal, numNodes int32) (*models.MaxAllocatableMemResponse, *models.Error) { - client, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, xerrors.ErrorWithContext(ctx, err) - } - - clusterResources, err := getMaxAllocatableMemory(ctx, client.CoreV1(), numNodes) - if err != nil { - return nil, xerrors.ErrorWithContext(ctx, err) - } - return clusterResources, nil -} - -func getNodeLabels(ctx context.Context, clientset v1.CoreV1Interface) (*models.NodeLabels, error) { - // get all nodes from cluster - nodes, err := clientset.Nodes().List(ctx, metav1.ListOptions{}) - if err != nil { - return nil, err - } - // make a map[string]set to avoid duplicate values - keyValueSet := map[string]set.StringSet{} - - for _, node := range nodes.Items { - for k, v := range node.Labels { - if _, ok := keyValueSet[k]; !ok { - keyValueSet[k] = set.NewStringSet() - } - keyValueSet[k].Add(v) - } - } - - // convert to output - res := models.NodeLabels{} - for k, valSet := range keyValueSet { - res[k] = valSet.ToSlice() - } - - return &res, nil -} - -func getNodeLabelsResponse(ctx context.Context, session *models.Principal) (*models.NodeLabels, *models.Error) { - client, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, xerrors.ErrorWithContext(ctx, err) - } - - clusterResources, err := getNodeLabels(ctx, client.CoreV1()) - if err != nil { - return nil, xerrors.ErrorWithContext(ctx, err) - } - return clusterResources, nil -} - -func getClusterResourcesInfo(numNodes int32, inNodesResources []NodeResourceInfo) *models.AllocatableResourcesResponse { - // purge any nodes with 0 cpu - var nodesResources []NodeResourceInfo - for _, n := range inNodesResources { - if n.AllocatableCPU > 0 { - nodesResources = append(nodesResources, n) - } - } - - if int32(len(nodesResources)) < numNodes || numNodes == 0 { - return &models.AllocatableResourcesResponse{ - CPUPriority: &models.NodeMaxAllocatableResources{ - MaxAllocatableCPU: 0, - MaxAllocatableMem: 0, - }, - MemPriority: &models.NodeMaxAllocatableResources{ - MaxAllocatableCPU: 0, - MaxAllocatableMem: 0, - }, - MinAllocatableCPU: 0, - MinAllocatableMem: 0, - } - } - - allocatableResources := &models.AllocatableResourcesResponse{} - - // sort nodesResources giving CPU priority - sort.Slice(nodesResources, func(i, j int) bool { return nodesResources[i].AllocatableCPU < nodesResources[j].AllocatableCPU }) - maxCPUNodesNeeded := len(nodesResources) - int(numNodes) - maxMemNodesNeeded := maxCPUNodesNeeded - - maxAllocatableCPU := nodesResources[maxCPUNodesNeeded].AllocatableCPU - minAllocatableCPU := nodesResources[maxCPUNodesNeeded].AllocatableCPU - minAllocatableMem := nodesResources[maxMemNodesNeeded].AllocatableMemory - - availableMemsForMaxCPU := []int64{} - for _, info := range nodesResources { - if info.AllocatableCPU >= maxAllocatableCPU { - availableMemsForMaxCPU = append(availableMemsForMaxCPU, info.AllocatableMemory) - } - // min allocatable resources overall - minAllocatableCPU = min(minAllocatableCPU, info.AllocatableCPU) - minAllocatableMem = min(minAllocatableMem, info.AllocatableMemory) - } - - sort.Slice(availableMemsForMaxCPU, func(i, j int) bool { return availableMemsForMaxCPU[i] < availableMemsForMaxCPU[j] }) - maxAllocatableMem := availableMemsForMaxCPU[len(availableMemsForMaxCPU)-int(numNodes)] - - allocatableResources.MinAllocatableCPU = minAllocatableCPU - allocatableResources.MinAllocatableMem = minAllocatableMem - allocatableResources.CPUPriority = &models.NodeMaxAllocatableResources{ - MaxAllocatableCPU: maxAllocatableCPU, - MaxAllocatableMem: maxAllocatableMem, - } - - // sort nodesResources giving Mem priority - sort.Slice(nodesResources, func(i, j int) bool { return nodesResources[i].AllocatableMemory < nodesResources[j].AllocatableMemory }) - maxMemNodesNeeded = len(nodesResources) - int(numNodes) - maxAllocatableMem = nodesResources[maxMemNodesNeeded].AllocatableMemory - - availableCPUsForMaxMem := []int64{} - for _, info := range nodesResources { - if info.AllocatableMemory >= maxAllocatableMem { - availableCPUsForMaxMem = append(availableCPUsForMaxMem, info.AllocatableCPU) - } - } - - sort.Slice(availableCPUsForMaxMem, func(i, j int) bool { return availableCPUsForMaxMem[i] < availableCPUsForMaxMem[j] }) - maxAllocatableCPU = availableCPUsForMaxMem[len(availableCPUsForMaxMem)-int(numNodes)] - - allocatableResources.MemPriority = &models.NodeMaxAllocatableResources{ - MaxAllocatableCPU: maxAllocatableCPU, - MaxAllocatableMem: maxAllocatableMem, - } - - return allocatableResources -} - -// getAllocatableResources get max allocatable memory given a desired number of nodes -func getAllocatableResources(ctx context.Context, clientset v1.CoreV1Interface, numNodes int32) (*models.AllocatableResourcesResponse, error) { - if numNodes == 0 { - return nil, errors.New("error NumNodes must be greated than 0") - } - - // get all nodes from cluster - nodes, err := clientset.Nodes().List(ctx, metav1.ListOptions{}) - if err != nil { - return nil, err - } - nodesInfo := []NodeResourceInfo{} -OUTER: - for _, n := range nodes.Items { - // Don't consider node if it has a NoSchedule or NoExecute Taint - for _, t := range n.Spec.Taints { - switch t.Effect { - case corev1.TaintEffectNoSchedule: - continue OUTER - case corev1.TaintEffectNoExecute: - continue OUTER - default: - continue - } - } - - var nodeMemory int64 - var nodeCPU int64 - if quantity, ok := n.Status.Allocatable[corev1.ResourceMemory]; ok { - // availableMemSizes = append(availableMemSizes, quantity.Value()) - nodeMemory = quantity.Value() - } - // we assume all nodes have allocatable cpu resource - if quantity, ok := n.Status.Allocatable[corev1.ResourceCPU]; ok { - // availableCPU = append(availableCPU, quantity.Value()) - nodeCPU = quantity.Value() - } - nodeInfo := NodeResourceInfo{ - Name: n.Name, - AllocatableCPU: nodeCPU, - AllocatableMemory: nodeMemory, - } - nodesInfo = append(nodesInfo, nodeInfo) - } - res := getClusterResourcesInfo(numNodes, nodesInfo) - - return res, nil -} - -// Get allocatable resources response - -func getAllocatableResourcesResponse(session *models.Principal, params operator_api.GetAllocatableResourcesParams) (*models.AllocatableResourcesResponse, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - client, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, xerrors.ErrorWithContext(ctx, err) - } - clusterResources, err := getAllocatableResources(ctx, client.CoreV1(), params.NumNodes) - if err != nil { - return nil, xerrors.ErrorWithContext(ctx, err) - } - return clusterResources, nil -} diff --git a/operatorapi/nodes_test.go b/operatorapi/nodes_test.go deleted file mode 100644 index 5e914a2d6..000000000 --- a/operatorapi/nodes_test.go +++ /dev/null @@ -1,366 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "reflect" - "testing" - - "github.com/minio/console/models" - - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/client-go/kubernetes/fake" -) - -func NoTestMaxAllocatableMemory(t *testing.T) { - type args struct { - ctx context.Context - numNodes int32 - objs []runtime.Object - } - tests := []struct { - name string - args args - expected *models.MaxAllocatableMemResponse - wantErr bool - }{ - { - name: "Get Max Ram No Taints", - args: args{ - ctx: context.Background(), - numNodes: 2, - objs: []runtime.Object{ - &corev1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: "node1", - }, - Status: corev1.NodeStatus{ - Allocatable: corev1.ResourceList{ - corev1.ResourceMemory: resource.MustParse("2Ki"), - corev1.ResourceCPU: resource.MustParse("4Ki"), - }, - }, - }, - &corev1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: "node2", - }, - Status: corev1.NodeStatus{ - Allocatable: corev1.ResourceList{ - corev1.ResourceMemory: resource.MustParse("512"), - corev1.ResourceCPU: resource.MustParse("1Ki"), - }, - }, - }, - }, - }, - expected: &models.MaxAllocatableMemResponse{ - MaxMemory: int64(512), - }, - wantErr: false, - }, - { - // Description: if there are more nodes than the amount - // of nodes we want to use, but one has taints of NoSchedule - // node should not be considered for max memory - name: "Get Max Ram on nodes with NoSchedule", - args: args{ - ctx: context.Background(), - numNodes: 2, - objs: []runtime.Object{ - &corev1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: "node1", - }, - Status: corev1.NodeStatus{ - Allocatable: corev1.ResourceList{ - corev1.ResourceMemory: resource.MustParse("2Ki"), - corev1.ResourceCPU: resource.MustParse("4Ki"), - }, - }, - }, - &corev1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: "node2", - }, - Spec: corev1.NodeSpec{ - Taints: []corev1.Taint{ - { - Key: "node.kubernetes.io/unreachable", - Effect: corev1.TaintEffectNoSchedule, - }, - }, - }, - Status: corev1.NodeStatus{ - Allocatable: corev1.ResourceList{ - corev1.ResourceMemory: resource.MustParse("6Ki"), - corev1.ResourceCPU: resource.MustParse("1Ki"), - }, - }, - }, - &corev1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: "node3", - }, - Status: corev1.NodeStatus{ - Allocatable: corev1.ResourceList{ - corev1.ResourceMemory: resource.MustParse("4Ki"), - corev1.ResourceCPU: resource.MustParse("1Ki"), - }, - }, - }, - }, - }, - expected: &models.MaxAllocatableMemResponse{ - MaxMemory: int64(2048), - }, - wantErr: false, - }, - { - // Description: if there are more nodes than the amount - // of nodes we want to use, but one has taints of NoExecute - // node should not be considered for max memory - // if one node has PreferNoSchedule that should be considered. - name: "Get Max Ram on nodes with NoExecute", - args: args{ - ctx: context.Background(), - numNodes: 2, - objs: []runtime.Object{ - &corev1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: "node1", - }, - Status: corev1.NodeStatus{ - Allocatable: corev1.ResourceList{ - corev1.ResourceMemory: resource.MustParse("2Ki"), - corev1.ResourceCPU: resource.MustParse("4Ki"), - }, - }, - }, - &corev1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: "node2", - }, - Spec: corev1.NodeSpec{ - Taints: []corev1.Taint{ - { - Key: "node.kubernetes.io/unreachable", - Effect: corev1.TaintEffectNoExecute, - }, - }, - }, - Status: corev1.NodeStatus{ - Allocatable: corev1.ResourceList{ - corev1.ResourceMemory: resource.MustParse("6Ki"), - corev1.ResourceCPU: resource.MustParse("1Ki"), - }, - }, - }, - &corev1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: "node3", - }, - Spec: corev1.NodeSpec{ - Taints: []corev1.Taint{ - { - Key: "node.kubernetes.io/unreachable", - Effect: corev1.TaintEffectPreferNoSchedule, - }, - }, - }, - Status: corev1.NodeStatus{ - Allocatable: corev1.ResourceList{ - corev1.ResourceMemory: resource.MustParse("4Ki"), - corev1.ResourceCPU: resource.MustParse("1Ki"), - }, - }, - }, - }, - }, - expected: &models.MaxAllocatableMemResponse{ - MaxMemory: int64(2048), - }, - wantErr: false, - }, - { - // Description: if there are more nodes than the amount - // of nodes we want to use, max allocatable memory should - // be the minimum ram on the n nodes requested - name: "Get Max Ram, several nodes available", - args: args{ - ctx: context.Background(), - numNodes: 2, - objs: []runtime.Object{ - &corev1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: "node1", - }, - Status: corev1.NodeStatus{ - Allocatable: corev1.ResourceList{ - corev1.ResourceMemory: resource.MustParse("2Ki"), - corev1.ResourceCPU: resource.MustParse("4Ki"), - }, - }, - }, - &corev1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: "node2", - }, - Status: corev1.NodeStatus{ - Allocatable: corev1.ResourceList{ - corev1.ResourceMemory: resource.MustParse("6Ki"), - corev1.ResourceCPU: resource.MustParse("1Ki"), - }, - }, - }, - &corev1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: "node3", - }, - Status: corev1.NodeStatus{ - Allocatable: corev1.ResourceList{ - corev1.ResourceMemory: resource.MustParse("4Ki"), - corev1.ResourceCPU: resource.MustParse("1Ki"), - }, - }, - }, - }, - }, - expected: &models.MaxAllocatableMemResponse{ - MaxMemory: int64(4096), - }, - wantErr: false, - }, - { - // Description: if request has nil as request, expect error - name: "Nil nodes should be greater than 0", - args: args{ - ctx: context.Background(), - numNodes: 0, - }, - wantErr: true, - }, - } - for _, tt := range tests { - kubeClient := fake.NewSimpleClientset(tt.args.objs...) - t.Run(tt.name, func(t *testing.T) { - got, err := getMaxAllocatableMemory(tt.args.ctx, kubeClient.CoreV1(), tt.args.numNodes) - if (err != nil) != tt.wantErr { - t.Errorf("getMaxAllocatableMemory() error = %v, wantErr %v", err, tt.wantErr) - } - if !reflect.DeepEqual(got, tt.expected) { - t.Errorf("\ngot: %d \nwant: %d", got, tt.expected) - } - }) - } -} - -func Test_MaxMemoryFunc(t *testing.T) { - type args struct { - numNodes int32 - nodesMemorySizes []int64 - } - tests := []struct { - name string - args args - expected int64 - wantErr bool - }{ - { - name: "Get Max memory", - args: args{ - numNodes: int32(4), - nodesMemorySizes: []int64{4294967296, 8589934592, 8589934592, 17179869184, 17179869184, 17179869184, 25769803776, 25769803776, 68719476736}, - }, - expected: int64(17179869184), - wantErr: false, - }, - { - // Description, if not enough nodes return 0 - name: "Get Max memory Not enough nodes", - args: args{ - numNodes: int32(4), - nodesMemorySizes: []int64{4294967296, 8589934592, 68719476736}, - }, - expected: int64(0), - wantErr: false, - }, - { - // Description, if not enough nodes return 0 - name: "Get Max memory no nodes", - args: args{ - numNodes: int32(4), - nodesMemorySizes: []int64{}, - }, - expected: int64(0), - wantErr: false, - }, - { - // Description, if not enough nodes return 0 - name: "Get Max memory no nodes, no request", - args: args{ - numNodes: int32(0), - nodesMemorySizes: []int64{}, - }, - expected: int64(0), - wantErr: false, - }, - { - // Description, if there are multiple nodes - // and required nodes is only 1, max should be equal to max memory - name: "Get Max memory one node", - args: args{ - numNodes: int32(1), - nodesMemorySizes: []int64{4294967296, 8589934592, 68719476736}, - }, - expected: int64(68719476736), - wantErr: false, - }, - { - // Description: if more nodes max memory should be the minimum - // value across pairs of numNodes - name: "Get Max memory two nodes", - args: args{ - numNodes: int32(2), - nodesMemorySizes: []int64{8589934592, 68719476736, 4294967296}, - }, - expected: int64(8589934592), - wantErr: false, - }, - { - name: "Get Max Multiple Memory Sizes", - args: args{ - numNodes: int32(4), - nodesMemorySizes: []int64{0, 0, 0, 0, 4294967296, 8589934592, 8589934592, 17179869184, 17179869184, 17179869184, 25769803776, 25769803776, 68719476736, 34359738368, 34359738368, 34359738368, 34359738368}, - }, - expected: int64(34359738368), - wantErr: false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got := getMaxClusterMemory(tt.args.numNodes, tt.args.nodesMemorySizes) - if !reflect.DeepEqual(got, tt.expected) { - t.Errorf("\ngot: %d \nwant: %d", got, tt.expected) - } - }) - } -} diff --git a/operatorapi/operations/auth/login_detail.go b/operatorapi/operations/auth/login_detail.go deleted file mode 100644 index 702ac8023..000000000 --- a/operatorapi/operations/auth/login_detail.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// LoginDetailHandlerFunc turns a function with the right signature into a login detail handler -type LoginDetailHandlerFunc func(LoginDetailParams) middleware.Responder - -// Handle executing the request and returning a response -func (fn LoginDetailHandlerFunc) Handle(params LoginDetailParams) middleware.Responder { - return fn(params) -} - -// LoginDetailHandler interface for that can handle valid login detail params -type LoginDetailHandler interface { - Handle(LoginDetailParams) middleware.Responder -} - -// NewLoginDetail creates a new http.Handler for the login detail operation -func NewLoginDetail(ctx *middleware.Context, handler LoginDetailHandler) *LoginDetail { - return &LoginDetail{Context: ctx, Handler: handler} -} - -/* - LoginDetail swagger:route GET /login Auth loginDetail - -Returns login strategy, form or sso. -*/ -type LoginDetail struct { - Context *middleware.Context - Handler LoginDetailHandler -} - -func (o *LoginDetail) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewLoginDetailParams() - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/auth/login_detail_parameters.go b/operatorapi/operations/auth/login_detail_parameters.go deleted file mode 100644 index 855456017..000000000 --- a/operatorapi/operations/auth/login_detail_parameters.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewLoginDetailParams creates a new LoginDetailParams object -// -// There are no default values defined in the spec. -func NewLoginDetailParams() LoginDetailParams { - - return LoginDetailParams{} -} - -// LoginDetailParams contains all the bound params for the login detail operation -// typically these are obtained from a http.Request -// -// swagger:parameters LoginDetail -type LoginDetailParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewLoginDetailParams() beforehand. -func (o *LoginDetailParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/auth/login_detail_responses.go b/operatorapi/operations/auth/login_detail_responses.go deleted file mode 100644 index bf7a2a354..000000000 --- a/operatorapi/operations/auth/login_detail_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// LoginDetailOKCode is the HTTP code returned for type LoginDetailOK -const LoginDetailOKCode int = 200 - -/* -LoginDetailOK A successful response. - -swagger:response loginDetailOK -*/ -type LoginDetailOK struct { - - /* - In: Body - */ - Payload *models.LoginDetails `json:"body,omitempty"` -} - -// NewLoginDetailOK creates LoginDetailOK with default headers values -func NewLoginDetailOK() *LoginDetailOK { - - return &LoginDetailOK{} -} - -// WithPayload adds the payload to the login detail o k response -func (o *LoginDetailOK) WithPayload(payload *models.LoginDetails) *LoginDetailOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the login detail o k response -func (o *LoginDetailOK) SetPayload(payload *models.LoginDetails) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *LoginDetailOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -LoginDetailDefault Generic error response. - -swagger:response loginDetailDefault -*/ -type LoginDetailDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewLoginDetailDefault creates LoginDetailDefault with default headers values -func NewLoginDetailDefault(code int) *LoginDetailDefault { - if code <= 0 { - code = 500 - } - - return &LoginDetailDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the login detail default response -func (o *LoginDetailDefault) WithStatusCode(code int) *LoginDetailDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the login detail default response -func (o *LoginDetailDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the login detail default response -func (o *LoginDetailDefault) WithPayload(payload *models.Error) *LoginDetailDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the login detail default response -func (o *LoginDetailDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *LoginDetailDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/auth/login_detail_urlbuilder.go b/operatorapi/operations/auth/login_detail_urlbuilder.go deleted file mode 100644 index 4482cc973..000000000 --- a/operatorapi/operations/auth/login_detail_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// LoginDetailURL generates an URL for the login detail operation -type LoginDetailURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *LoginDetailURL) WithBasePath(bp string) *LoginDetailURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *LoginDetailURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *LoginDetailURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/login" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *LoginDetailURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *LoginDetailURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *LoginDetailURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on LoginDetailURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on LoginDetailURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *LoginDetailURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/auth/login_oauth2_auth.go b/operatorapi/operations/auth/login_oauth2_auth.go deleted file mode 100644 index 05248cc7b..000000000 --- a/operatorapi/operations/auth/login_oauth2_auth.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// LoginOauth2AuthHandlerFunc turns a function with the right signature into a login oauth2 auth handler -type LoginOauth2AuthHandlerFunc func(LoginOauth2AuthParams) middleware.Responder - -// Handle executing the request and returning a response -func (fn LoginOauth2AuthHandlerFunc) Handle(params LoginOauth2AuthParams) middleware.Responder { - return fn(params) -} - -// LoginOauth2AuthHandler interface for that can handle valid login oauth2 auth params -type LoginOauth2AuthHandler interface { - Handle(LoginOauth2AuthParams) middleware.Responder -} - -// NewLoginOauth2Auth creates a new http.Handler for the login oauth2 auth operation -func NewLoginOauth2Auth(ctx *middleware.Context, handler LoginOauth2AuthHandler) *LoginOauth2Auth { - return &LoginOauth2Auth{Context: ctx, Handler: handler} -} - -/* - LoginOauth2Auth swagger:route POST /login/oauth2/auth Auth loginOauth2Auth - -Identity Provider oauth2 callback endpoint. -*/ -type LoginOauth2Auth struct { - Context *middleware.Context - Handler LoginOauth2AuthHandler -} - -func (o *LoginOauth2Auth) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewLoginOauth2AuthParams() - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/auth/login_oauth2_auth_parameters.go b/operatorapi/operations/auth/login_oauth2_auth_parameters.go deleted file mode 100644 index 3b822222b..000000000 --- a/operatorapi/operations/auth/login_oauth2_auth_parameters.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewLoginOauth2AuthParams creates a new LoginOauth2AuthParams object -// -// There are no default values defined in the spec. -func NewLoginOauth2AuthParams() LoginOauth2AuthParams { - - return LoginOauth2AuthParams{} -} - -// LoginOauth2AuthParams contains all the bound params for the login oauth2 auth operation -// typically these are obtained from a http.Request -// -// swagger:parameters LoginOauth2Auth -type LoginOauth2AuthParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.LoginOauth2AuthRequest -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewLoginOauth2AuthParams() beforehand. -func (o *LoginOauth2AuthParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LoginOauth2AuthRequest - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/auth/login_oauth2_auth_responses.go b/operatorapi/operations/auth/login_oauth2_auth_responses.go deleted file mode 100644 index a0817f141..000000000 --- a/operatorapi/operations/auth/login_oauth2_auth_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// LoginOauth2AuthNoContentCode is the HTTP code returned for type LoginOauth2AuthNoContent -const LoginOauth2AuthNoContentCode int = 204 - -/* -LoginOauth2AuthNoContent A successful login. - -swagger:response loginOauth2AuthNoContent -*/ -type LoginOauth2AuthNoContent struct { -} - -// NewLoginOauth2AuthNoContent creates LoginOauth2AuthNoContent with default headers values -func NewLoginOauth2AuthNoContent() *LoginOauth2AuthNoContent { - - return &LoginOauth2AuthNoContent{} -} - -// WriteResponse to the client -func (o *LoginOauth2AuthNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -LoginOauth2AuthDefault Generic error response. - -swagger:response loginOauth2AuthDefault -*/ -type LoginOauth2AuthDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewLoginOauth2AuthDefault creates LoginOauth2AuthDefault with default headers values -func NewLoginOauth2AuthDefault(code int) *LoginOauth2AuthDefault { - if code <= 0 { - code = 500 - } - - return &LoginOauth2AuthDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the login oauth2 auth default response -func (o *LoginOauth2AuthDefault) WithStatusCode(code int) *LoginOauth2AuthDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the login oauth2 auth default response -func (o *LoginOauth2AuthDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the login oauth2 auth default response -func (o *LoginOauth2AuthDefault) WithPayload(payload *models.Error) *LoginOauth2AuthDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the login oauth2 auth default response -func (o *LoginOauth2AuthDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *LoginOauth2AuthDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/auth/login_oauth2_auth_urlbuilder.go b/operatorapi/operations/auth/login_oauth2_auth_urlbuilder.go deleted file mode 100644 index 9e2ab8a2b..000000000 --- a/operatorapi/operations/auth/login_oauth2_auth_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// LoginOauth2AuthURL generates an URL for the login oauth2 auth operation -type LoginOauth2AuthURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *LoginOauth2AuthURL) WithBasePath(bp string) *LoginOauth2AuthURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *LoginOauth2AuthURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *LoginOauth2AuthURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/login/oauth2/auth" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *LoginOauth2AuthURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *LoginOauth2AuthURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *LoginOauth2AuthURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on LoginOauth2AuthURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on LoginOauth2AuthURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *LoginOauth2AuthURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/auth/login_operator.go b/operatorapi/operations/auth/login_operator.go deleted file mode 100644 index 8b28e2f77..000000000 --- a/operatorapi/operations/auth/login_operator.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// LoginOperatorHandlerFunc turns a function with the right signature into a login operator handler -type LoginOperatorHandlerFunc func(LoginOperatorParams) middleware.Responder - -// Handle executing the request and returning a response -func (fn LoginOperatorHandlerFunc) Handle(params LoginOperatorParams) middleware.Responder { - return fn(params) -} - -// LoginOperatorHandler interface for that can handle valid login operator params -type LoginOperatorHandler interface { - Handle(LoginOperatorParams) middleware.Responder -} - -// NewLoginOperator creates a new http.Handler for the login operator operation -func NewLoginOperator(ctx *middleware.Context, handler LoginOperatorHandler) *LoginOperator { - return &LoginOperator{Context: ctx, Handler: handler} -} - -/* - LoginOperator swagger:route POST /login/operator Auth loginOperator - -Login to Operator Console. -*/ -type LoginOperator struct { - Context *middleware.Context - Handler LoginOperatorHandler -} - -func (o *LoginOperator) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewLoginOperatorParams() - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/auth/login_operator_parameters.go b/operatorapi/operations/auth/login_operator_parameters.go deleted file mode 100644 index 12ff50ff7..000000000 --- a/operatorapi/operations/auth/login_operator_parameters.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewLoginOperatorParams creates a new LoginOperatorParams object -// -// There are no default values defined in the spec. -func NewLoginOperatorParams() LoginOperatorParams { - - return LoginOperatorParams{} -} - -// LoginOperatorParams contains all the bound params for the login operator operation -// typically these are obtained from a http.Request -// -// swagger:parameters LoginOperator -type LoginOperatorParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.LoginOperatorRequest -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewLoginOperatorParams() beforehand. -func (o *LoginOperatorParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LoginOperatorRequest - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/auth/login_operator_responses.go b/operatorapi/operations/auth/login_operator_responses.go deleted file mode 100644 index b2bf8f152..000000000 --- a/operatorapi/operations/auth/login_operator_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// LoginOperatorNoContentCode is the HTTP code returned for type LoginOperatorNoContent -const LoginOperatorNoContentCode int = 204 - -/* -LoginOperatorNoContent A successful login. - -swagger:response loginOperatorNoContent -*/ -type LoginOperatorNoContent struct { -} - -// NewLoginOperatorNoContent creates LoginOperatorNoContent with default headers values -func NewLoginOperatorNoContent() *LoginOperatorNoContent { - - return &LoginOperatorNoContent{} -} - -// WriteResponse to the client -func (o *LoginOperatorNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -LoginOperatorDefault Generic error response. - -swagger:response loginOperatorDefault -*/ -type LoginOperatorDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewLoginOperatorDefault creates LoginOperatorDefault with default headers values -func NewLoginOperatorDefault(code int) *LoginOperatorDefault { - if code <= 0 { - code = 500 - } - - return &LoginOperatorDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the login operator default response -func (o *LoginOperatorDefault) WithStatusCode(code int) *LoginOperatorDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the login operator default response -func (o *LoginOperatorDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the login operator default response -func (o *LoginOperatorDefault) WithPayload(payload *models.Error) *LoginOperatorDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the login operator default response -func (o *LoginOperatorDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *LoginOperatorDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/auth/login_operator_urlbuilder.go b/operatorapi/operations/auth/login_operator_urlbuilder.go deleted file mode 100644 index 14a6deb7c..000000000 --- a/operatorapi/operations/auth/login_operator_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// LoginOperatorURL generates an URL for the login operator operation -type LoginOperatorURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *LoginOperatorURL) WithBasePath(bp string) *LoginOperatorURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *LoginOperatorURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *LoginOperatorURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/login/operator" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *LoginOperatorURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *LoginOperatorURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *LoginOperatorURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on LoginOperatorURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on LoginOperatorURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *LoginOperatorURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/auth/logout.go b/operatorapi/operations/auth/logout.go deleted file mode 100644 index fa0481ab5..000000000 --- a/operatorapi/operations/auth/logout.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// LogoutHandlerFunc turns a function with the right signature into a logout handler -type LogoutHandlerFunc func(LogoutParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn LogoutHandlerFunc) Handle(params LogoutParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// LogoutHandler interface for that can handle valid logout params -type LogoutHandler interface { - Handle(LogoutParams, *models.Principal) middleware.Responder -} - -// NewLogout creates a new http.Handler for the logout operation -func NewLogout(ctx *middleware.Context, handler LogoutHandler) *Logout { - return &Logout{Context: ctx, Handler: handler} -} - -/* - Logout swagger:route POST /logout Auth logout - -Logout from Operator. -*/ -type Logout struct { - Context *middleware.Context - Handler LogoutHandler -} - -func (o *Logout) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewLogoutParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/auth/logout_parameters.go b/operatorapi/operations/auth/logout_parameters.go deleted file mode 100644 index 816ebeffa..000000000 --- a/operatorapi/operations/auth/logout_parameters.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewLogoutParams creates a new LogoutParams object -// -// There are no default values defined in the spec. -func NewLogoutParams() LogoutParams { - - return LogoutParams{} -} - -// LogoutParams contains all the bound params for the logout operation -// typically these are obtained from a http.Request -// -// swagger:parameters Logout -type LogoutParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewLogoutParams() beforehand. -func (o *LogoutParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/auth/logout_responses.go b/operatorapi/operations/auth/logout_responses.go deleted file mode 100644 index a4c4cdd9b..000000000 --- a/operatorapi/operations/auth/logout_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// LogoutOKCode is the HTTP code returned for type LogoutOK -const LogoutOKCode int = 200 - -/* -LogoutOK A successful response. - -swagger:response logoutOK -*/ -type LogoutOK struct { -} - -// NewLogoutOK creates LogoutOK with default headers values -func NewLogoutOK() *LogoutOK { - - return &LogoutOK{} -} - -// WriteResponse to the client -func (o *LogoutOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(200) -} - -/* -LogoutDefault Generic error response. - -swagger:response logoutDefault -*/ -type LogoutDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewLogoutDefault creates LogoutDefault with default headers values -func NewLogoutDefault(code int) *LogoutDefault { - if code <= 0 { - code = 500 - } - - return &LogoutDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the logout default response -func (o *LogoutDefault) WithStatusCode(code int) *LogoutDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the logout default response -func (o *LogoutDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the logout default response -func (o *LogoutDefault) WithPayload(payload *models.Error) *LogoutDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the logout default response -func (o *LogoutDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *LogoutDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/auth/logout_urlbuilder.go b/operatorapi/operations/auth/logout_urlbuilder.go deleted file mode 100644 index fac1e80b2..000000000 --- a/operatorapi/operations/auth/logout_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// LogoutURL generates an URL for the logout operation -type LogoutURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *LogoutURL) WithBasePath(bp string) *LogoutURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *LogoutURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *LogoutURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/logout" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *LogoutURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *LogoutURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *LogoutURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on LogoutURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on LogoutURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *LogoutURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/auth/session_check.go b/operatorapi/operations/auth/session_check.go deleted file mode 100644 index 5026649ee..000000000 --- a/operatorapi/operations/auth/session_check.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// SessionCheckHandlerFunc turns a function with the right signature into a session check handler -type SessionCheckHandlerFunc func(SessionCheckParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn SessionCheckHandlerFunc) Handle(params SessionCheckParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// SessionCheckHandler interface for that can handle valid session check params -type SessionCheckHandler interface { - Handle(SessionCheckParams, *models.Principal) middleware.Responder -} - -// NewSessionCheck creates a new http.Handler for the session check operation -func NewSessionCheck(ctx *middleware.Context, handler SessionCheckHandler) *SessionCheck { - return &SessionCheck{Context: ctx, Handler: handler} -} - -/* - SessionCheck swagger:route GET /session Auth sessionCheck - -Endpoint to check if your session is still valid -*/ -type SessionCheck struct { - Context *middleware.Context - Handler SessionCheckHandler -} - -func (o *SessionCheck) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewSessionCheckParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/auth/session_check_parameters.go b/operatorapi/operations/auth/session_check_parameters.go deleted file mode 100644 index 683f0c8a5..000000000 --- a/operatorapi/operations/auth/session_check_parameters.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewSessionCheckParams creates a new SessionCheckParams object -// -// There are no default values defined in the spec. -func NewSessionCheckParams() SessionCheckParams { - - return SessionCheckParams{} -} - -// SessionCheckParams contains all the bound params for the session check operation -// typically these are obtained from a http.Request -// -// swagger:parameters SessionCheck -type SessionCheckParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewSessionCheckParams() beforehand. -func (o *SessionCheckParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/auth/session_check_responses.go b/operatorapi/operations/auth/session_check_responses.go deleted file mode 100644 index 2716279a7..000000000 --- a/operatorapi/operations/auth/session_check_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// SessionCheckOKCode is the HTTP code returned for type SessionCheckOK -const SessionCheckOKCode int = 200 - -/* -SessionCheckOK A successful response. - -swagger:response sessionCheckOK -*/ -type SessionCheckOK struct { - - /* - In: Body - */ - Payload *models.OperatorSessionResponse `json:"body,omitempty"` -} - -// NewSessionCheckOK creates SessionCheckOK with default headers values -func NewSessionCheckOK() *SessionCheckOK { - - return &SessionCheckOK{} -} - -// WithPayload adds the payload to the session check o k response -func (o *SessionCheckOK) WithPayload(payload *models.OperatorSessionResponse) *SessionCheckOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the session check o k response -func (o *SessionCheckOK) SetPayload(payload *models.OperatorSessionResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SessionCheckOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -SessionCheckDefault Generic error response. - -swagger:response sessionCheckDefault -*/ -type SessionCheckDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewSessionCheckDefault creates SessionCheckDefault with default headers values -func NewSessionCheckDefault(code int) *SessionCheckDefault { - if code <= 0 { - code = 500 - } - - return &SessionCheckDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the session check default response -func (o *SessionCheckDefault) WithStatusCode(code int) *SessionCheckDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the session check default response -func (o *SessionCheckDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the session check default response -func (o *SessionCheckDefault) WithPayload(payload *models.Error) *SessionCheckDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the session check default response -func (o *SessionCheckDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SessionCheckDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/auth/session_check_urlbuilder.go b/operatorapi/operations/auth/session_check_urlbuilder.go deleted file mode 100644 index 107804b34..000000000 --- a/operatorapi/operations/auth/session_check_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package auth - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// SessionCheckURL generates an URL for the session check operation -type SessionCheckURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SessionCheckURL) WithBasePath(bp string) *SessionCheckURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SessionCheckURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *SessionCheckURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/session" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *SessionCheckURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *SessionCheckURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *SessionCheckURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on SessionCheckURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on SessionCheckURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *SessionCheckURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api.go b/operatorapi/operations/operator_api.go deleted file mode 100644 index 076e82d2d..000000000 --- a/operatorapi/operations/operator_api.go +++ /dev/null @@ -1,1142 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operations - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "net/http" - "strings" - - "github.com/go-openapi/errors" - "github.com/go-openapi/loads" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/runtime/security" - "github.com/go-openapi/spec" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations/auth" - "github.com/minio/console/operatorapi/operations/operator_api" - "github.com/minio/console/operatorapi/operations/user_api" -) - -// NewOperatorAPI creates a new Operator instance -func NewOperatorAPI(spec *loads.Document) *OperatorAPI { - return &OperatorAPI{ - handlers: make(map[string]map[string]http.Handler), - formats: strfmt.Default, - defaultConsumes: "application/json", - defaultProduces: "application/json", - customConsumers: make(map[string]runtime.Consumer), - customProducers: make(map[string]runtime.Producer), - PreServerShutdown: func() {}, - ServerShutdown: func() {}, - spec: spec, - useSwaggerUI: false, - ServeError: errors.ServeError, - BasicAuthenticator: security.BasicAuth, - APIKeyAuthenticator: security.APIKeyAuth, - BearerAuthenticator: security.BearerAuth, - - JSONConsumer: runtime.JSONConsumer(), - - JSONProducer: runtime.JSONProducer(), - - UserAPICheckMinIOVersionHandler: user_api.CheckMinIOVersionHandlerFunc(func(params user_api.CheckMinIOVersionParams) middleware.Responder { - return middleware.NotImplemented("operation user_api.CheckMinIOVersion has not yet been implemented") - }), - OperatorAPICreateNamespaceHandler: operator_api.CreateNamespaceHandlerFunc(func(params operator_api.CreateNamespaceParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.CreateNamespace has not yet been implemented") - }), - OperatorAPICreateTenantHandler: operator_api.CreateTenantHandlerFunc(func(params operator_api.CreateTenantParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.CreateTenant has not yet been implemented") - }), - OperatorAPIDeletePVCHandler: operator_api.DeletePVCHandlerFunc(func(params operator_api.DeletePVCParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.DeletePVC has not yet been implemented") - }), - OperatorAPIDeletePodHandler: operator_api.DeletePodHandlerFunc(func(params operator_api.DeletePodParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.DeletePod has not yet been implemented") - }), - OperatorAPIDeleteTenantHandler: operator_api.DeleteTenantHandlerFunc(func(params operator_api.DeleteTenantParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.DeleteTenant has not yet been implemented") - }), - OperatorAPIDescribePodHandler: operator_api.DescribePodHandlerFunc(func(params operator_api.DescribePodParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.DescribePod has not yet been implemented") - }), - OperatorAPIDirectPVFormatDriveHandler: operator_api.DirectPVFormatDriveHandlerFunc(func(params operator_api.DirectPVFormatDriveParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.DirectPVFormatDrive has not yet been implemented") - }), - OperatorAPIDisableTenantLoggingHandler: operator_api.DisableTenantLoggingHandlerFunc(func(params operator_api.DisableTenantLoggingParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.DisableTenantLogging has not yet been implemented") - }), - OperatorAPIEnableTenantLoggingHandler: operator_api.EnableTenantLoggingHandlerFunc(func(params operator_api.EnableTenantLoggingParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.EnableTenantLogging has not yet been implemented") - }), - OperatorAPIGetAllocatableResourcesHandler: operator_api.GetAllocatableResourcesHandlerFunc(func(params operator_api.GetAllocatableResourcesParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.GetAllocatableResources has not yet been implemented") - }), - OperatorAPIGetDirectPVDriveListHandler: operator_api.GetDirectPVDriveListHandlerFunc(func(params operator_api.GetDirectPVDriveListParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.GetDirectPVDriveList has not yet been implemented") - }), - OperatorAPIGetDirectPVVolumeListHandler: operator_api.GetDirectPVVolumeListHandlerFunc(func(params operator_api.GetDirectPVVolumeListParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.GetDirectPVVolumeList has not yet been implemented") - }), - OperatorAPIGetMPIntegrationHandler: operator_api.GetMPIntegrationHandlerFunc(func(params operator_api.GetMPIntegrationParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.GetMPIntegration has not yet been implemented") - }), - OperatorAPIGetMaxAllocatableMemHandler: operator_api.GetMaxAllocatableMemHandlerFunc(func(params operator_api.GetMaxAllocatableMemParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.GetMaxAllocatableMem has not yet been implemented") - }), - OperatorAPIGetPVCDescribeHandler: operator_api.GetPVCDescribeHandlerFunc(func(params operator_api.GetPVCDescribeParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.GetPVCDescribe has not yet been implemented") - }), - OperatorAPIGetPVCEventsHandler: operator_api.GetPVCEventsHandlerFunc(func(params operator_api.GetPVCEventsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.GetPVCEvents has not yet been implemented") - }), - OperatorAPIGetParityHandler: operator_api.GetParityHandlerFunc(func(params operator_api.GetParityParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.GetParity has not yet been implemented") - }), - OperatorAPIGetPodEventsHandler: operator_api.GetPodEventsHandlerFunc(func(params operator_api.GetPodEventsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.GetPodEvents has not yet been implemented") - }), - OperatorAPIGetPodLogsHandler: operator_api.GetPodLogsHandlerFunc(func(params operator_api.GetPodLogsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.GetPodLogs has not yet been implemented") - }), - OperatorAPIGetResourceQuotaHandler: operator_api.GetResourceQuotaHandlerFunc(func(params operator_api.GetResourceQuotaParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.GetResourceQuota has not yet been implemented") - }), - OperatorAPIGetTenantEventsHandler: operator_api.GetTenantEventsHandlerFunc(func(params operator_api.GetTenantEventsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.GetTenantEvents has not yet been implemented") - }), - OperatorAPIGetTenantLogsHandler: operator_api.GetTenantLogsHandlerFunc(func(params operator_api.GetTenantLogsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.GetTenantLogs has not yet been implemented") - }), - OperatorAPIGetTenantMonitoringHandler: operator_api.GetTenantMonitoringHandlerFunc(func(params operator_api.GetTenantMonitoringParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.GetTenantMonitoring has not yet been implemented") - }), - OperatorAPIGetTenantPodsHandler: operator_api.GetTenantPodsHandlerFunc(func(params operator_api.GetTenantPodsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.GetTenantPods has not yet been implemented") - }), - OperatorAPIGetTenantUsageHandler: operator_api.GetTenantUsageHandlerFunc(func(params operator_api.GetTenantUsageParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.GetTenantUsage has not yet been implemented") - }), - OperatorAPIGetTenantYAMLHandler: operator_api.GetTenantYAMLHandlerFunc(func(params operator_api.GetTenantYAMLParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.GetTenantYAML has not yet been implemented") - }), - OperatorAPIListAllTenantsHandler: operator_api.ListAllTenantsHandlerFunc(func(params operator_api.ListAllTenantsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.ListAllTenants has not yet been implemented") - }), - OperatorAPIListNodeLabelsHandler: operator_api.ListNodeLabelsHandlerFunc(func(params operator_api.ListNodeLabelsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.ListNodeLabels has not yet been implemented") - }), - OperatorAPIListPVCsHandler: operator_api.ListPVCsHandlerFunc(func(params operator_api.ListPVCsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.ListPVCs has not yet been implemented") - }), - OperatorAPIListPVCsForTenantHandler: operator_api.ListPVCsForTenantHandlerFunc(func(params operator_api.ListPVCsForTenantParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.ListPVCsForTenant has not yet been implemented") - }), - OperatorAPIListTenantCertificateSigningRequestHandler: operator_api.ListTenantCertificateSigningRequestHandlerFunc(func(params operator_api.ListTenantCertificateSigningRequestParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.ListTenantCertificateSigningRequest has not yet been implemented") - }), - OperatorAPIListTenantsHandler: operator_api.ListTenantsHandlerFunc(func(params operator_api.ListTenantsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.ListTenants has not yet been implemented") - }), - AuthLoginDetailHandler: auth.LoginDetailHandlerFunc(func(params auth.LoginDetailParams) middleware.Responder { - return middleware.NotImplemented("operation auth.LoginDetail has not yet been implemented") - }), - AuthLoginOauth2AuthHandler: auth.LoginOauth2AuthHandlerFunc(func(params auth.LoginOauth2AuthParams) middleware.Responder { - return middleware.NotImplemented("operation auth.LoginOauth2Auth has not yet been implemented") - }), - AuthLoginOperatorHandler: auth.LoginOperatorHandlerFunc(func(params auth.LoginOperatorParams) middleware.Responder { - return middleware.NotImplemented("operation auth.LoginOperator has not yet been implemented") - }), - AuthLogoutHandler: auth.LogoutHandlerFunc(func(params auth.LogoutParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation auth.Logout has not yet been implemented") - }), - OperatorAPIOperatorSubnetAPIKeyInfoHandler: operator_api.OperatorSubnetAPIKeyInfoHandlerFunc(func(params operator_api.OperatorSubnetAPIKeyInfoParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.OperatorSubnetAPIKeyInfo has not yet been implemented") - }), - OperatorAPIOperatorSubnetAPIKeyHandler: operator_api.OperatorSubnetAPIKeyHandlerFunc(func(params operator_api.OperatorSubnetAPIKeyParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.OperatorSubnetAPIKey has not yet been implemented") - }), - OperatorAPIOperatorSubnetLoginHandler: operator_api.OperatorSubnetLoginHandlerFunc(func(params operator_api.OperatorSubnetLoginParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.OperatorSubnetLogin has not yet been implemented") - }), - OperatorAPIOperatorSubnetLoginMFAHandler: operator_api.OperatorSubnetLoginMFAHandlerFunc(func(params operator_api.OperatorSubnetLoginMFAParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.OperatorSubnetLoginMFA has not yet been implemented") - }), - OperatorAPIOperatorSubnetRegisterAPIKeyHandler: operator_api.OperatorSubnetRegisterAPIKeyHandlerFunc(func(params operator_api.OperatorSubnetRegisterAPIKeyParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.OperatorSubnetRegisterAPIKey has not yet been implemented") - }), - OperatorAPIPostMPIntegrationHandler: operator_api.PostMPIntegrationHandlerFunc(func(params operator_api.PostMPIntegrationParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.PostMPIntegration has not yet been implemented") - }), - OperatorAPIPutTenantYAMLHandler: operator_api.PutTenantYAMLHandlerFunc(func(params operator_api.PutTenantYAMLParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.PutTenantYAML has not yet been implemented") - }), - AuthSessionCheckHandler: auth.SessionCheckHandlerFunc(func(params auth.SessionCheckParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation auth.SessionCheck has not yet been implemented") - }), - OperatorAPISetTenantAdministratorsHandler: operator_api.SetTenantAdministratorsHandlerFunc(func(params operator_api.SetTenantAdministratorsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.SetTenantAdministrators has not yet been implemented") - }), - OperatorAPISetTenantLogsHandler: operator_api.SetTenantLogsHandlerFunc(func(params operator_api.SetTenantLogsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.SetTenantLogs has not yet been implemented") - }), - OperatorAPISetTenantMonitoringHandler: operator_api.SetTenantMonitoringHandlerFunc(func(params operator_api.SetTenantMonitoringParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.SetTenantMonitoring has not yet been implemented") - }), - OperatorAPISubscriptionActivateHandler: operator_api.SubscriptionActivateHandlerFunc(func(params operator_api.SubscriptionActivateParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.SubscriptionActivate has not yet been implemented") - }), - OperatorAPISubscriptionInfoHandler: operator_api.SubscriptionInfoHandlerFunc(func(params operator_api.SubscriptionInfoParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.SubscriptionInfo has not yet been implemented") - }), - OperatorAPISubscriptionRefreshHandler: operator_api.SubscriptionRefreshHandlerFunc(func(params operator_api.SubscriptionRefreshParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.SubscriptionRefresh has not yet been implemented") - }), - OperatorAPISubscriptionValidateHandler: operator_api.SubscriptionValidateHandlerFunc(func(params operator_api.SubscriptionValidateParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.SubscriptionValidate has not yet been implemented") - }), - OperatorAPITenantAddPoolHandler: operator_api.TenantAddPoolHandlerFunc(func(params operator_api.TenantAddPoolParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.TenantAddPool has not yet been implemented") - }), - OperatorAPITenantConfigurationHandler: operator_api.TenantConfigurationHandlerFunc(func(params operator_api.TenantConfigurationParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.TenantConfiguration has not yet been implemented") - }), - OperatorAPITenantDeleteEncryptionHandler: operator_api.TenantDeleteEncryptionHandlerFunc(func(params operator_api.TenantDeleteEncryptionParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.TenantDeleteEncryption has not yet been implemented") - }), - OperatorAPITenantDetailsHandler: operator_api.TenantDetailsHandlerFunc(func(params operator_api.TenantDetailsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.TenantDetails has not yet been implemented") - }), - OperatorAPITenantEncryptionInfoHandler: operator_api.TenantEncryptionInfoHandlerFunc(func(params operator_api.TenantEncryptionInfoParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.TenantEncryptionInfo has not yet been implemented") - }), - OperatorAPITenantIdentityProviderHandler: operator_api.TenantIdentityProviderHandlerFunc(func(params operator_api.TenantIdentityProviderParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.TenantIdentityProvider has not yet been implemented") - }), - OperatorAPITenantSecurityHandler: operator_api.TenantSecurityHandlerFunc(func(params operator_api.TenantSecurityParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.TenantSecurity has not yet been implemented") - }), - OperatorAPITenantUpdateCertificateHandler: operator_api.TenantUpdateCertificateHandlerFunc(func(params operator_api.TenantUpdateCertificateParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.TenantUpdateCertificate has not yet been implemented") - }), - OperatorAPITenantUpdateEncryptionHandler: operator_api.TenantUpdateEncryptionHandlerFunc(func(params operator_api.TenantUpdateEncryptionParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.TenantUpdateEncryption has not yet been implemented") - }), - OperatorAPITenantUpdatePoolsHandler: operator_api.TenantUpdatePoolsHandlerFunc(func(params operator_api.TenantUpdatePoolsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.TenantUpdatePools has not yet been implemented") - }), - OperatorAPIUpdateTenantHandler: operator_api.UpdateTenantHandlerFunc(func(params operator_api.UpdateTenantParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.UpdateTenant has not yet been implemented") - }), - OperatorAPIUpdateTenantConfigurationHandler: operator_api.UpdateTenantConfigurationHandlerFunc(func(params operator_api.UpdateTenantConfigurationParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.UpdateTenantConfiguration has not yet been implemented") - }), - OperatorAPIUpdateTenantDomainsHandler: operator_api.UpdateTenantDomainsHandlerFunc(func(params operator_api.UpdateTenantDomainsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.UpdateTenantDomains has not yet been implemented") - }), - OperatorAPIUpdateTenantIdentityProviderHandler: operator_api.UpdateTenantIdentityProviderHandlerFunc(func(params operator_api.UpdateTenantIdentityProviderParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.UpdateTenantIdentityProvider has not yet been implemented") - }), - OperatorAPIUpdateTenantSecurityHandler: operator_api.UpdateTenantSecurityHandlerFunc(func(params operator_api.UpdateTenantSecurityParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation operator_api.UpdateTenantSecurity has not yet been implemented") - }), - - KeyAuth: func(token string, scopes []string) (*models.Principal, error) { - return nil, errors.NotImplemented("oauth2 bearer auth (key) has not yet been implemented") - }, - // default authorizer is authorized meaning no requests are blocked - APIAuthorizer: security.Authorized(), - } -} - -/*OperatorAPI the operator API */ -type OperatorAPI struct { - spec *loads.Document - context *middleware.Context - handlers map[string]map[string]http.Handler - formats strfmt.Registry - customConsumers map[string]runtime.Consumer - customProducers map[string]runtime.Producer - defaultConsumes string - defaultProduces string - Middleware func(middleware.Builder) http.Handler - useSwaggerUI bool - - // BasicAuthenticator generates a runtime.Authenticator from the supplied basic auth function. - // It has a default implementation in the security package, however you can replace it for your particular usage. - BasicAuthenticator func(security.UserPassAuthentication) runtime.Authenticator - - // APIKeyAuthenticator generates a runtime.Authenticator from the supplied token auth function. - // It has a default implementation in the security package, however you can replace it for your particular usage. - APIKeyAuthenticator func(string, string, security.TokenAuthentication) runtime.Authenticator - - // BearerAuthenticator generates a runtime.Authenticator from the supplied bearer token auth function. - // It has a default implementation in the security package, however you can replace it for your particular usage. - BearerAuthenticator func(string, security.ScopedTokenAuthentication) runtime.Authenticator - - // JSONConsumer registers a consumer for the following mime types: - // - application/json - JSONConsumer runtime.Consumer - - // JSONProducer registers a producer for the following mime types: - // - application/json - JSONProducer runtime.Producer - - // KeyAuth registers a function that takes an access token and a collection of required scopes and returns a principal - // it performs authentication based on an oauth2 bearer token provided in the request - KeyAuth func(string, []string) (*models.Principal, error) - - // APIAuthorizer provides access control (ACL/RBAC/ABAC) by providing access to the request and authenticated principal - APIAuthorizer runtime.Authorizer - - // UserAPICheckMinIOVersionHandler sets the operation handler for the check min i o version operation - UserAPICheckMinIOVersionHandler user_api.CheckMinIOVersionHandler - // OperatorAPICreateNamespaceHandler sets the operation handler for the create namespace operation - OperatorAPICreateNamespaceHandler operator_api.CreateNamespaceHandler - // OperatorAPICreateTenantHandler sets the operation handler for the create tenant operation - OperatorAPICreateTenantHandler operator_api.CreateTenantHandler - // OperatorAPIDeletePVCHandler sets the operation handler for the delete p v c operation - OperatorAPIDeletePVCHandler operator_api.DeletePVCHandler - // OperatorAPIDeletePodHandler sets the operation handler for the delete pod operation - OperatorAPIDeletePodHandler operator_api.DeletePodHandler - // OperatorAPIDeleteTenantHandler sets the operation handler for the delete tenant operation - OperatorAPIDeleteTenantHandler operator_api.DeleteTenantHandler - // OperatorAPIDescribePodHandler sets the operation handler for the describe pod operation - OperatorAPIDescribePodHandler operator_api.DescribePodHandler - // OperatorAPIDirectPVFormatDriveHandler sets the operation handler for the direct p v format drive operation - OperatorAPIDirectPVFormatDriveHandler operator_api.DirectPVFormatDriveHandler - // OperatorAPIDisableTenantLoggingHandler sets the operation handler for the disable tenant logging operation - OperatorAPIDisableTenantLoggingHandler operator_api.DisableTenantLoggingHandler - // OperatorAPIEnableTenantLoggingHandler sets the operation handler for the enable tenant logging operation - OperatorAPIEnableTenantLoggingHandler operator_api.EnableTenantLoggingHandler - // OperatorAPIGetAllocatableResourcesHandler sets the operation handler for the get allocatable resources operation - OperatorAPIGetAllocatableResourcesHandler operator_api.GetAllocatableResourcesHandler - // OperatorAPIGetDirectPVDriveListHandler sets the operation handler for the get direct p v drive list operation - OperatorAPIGetDirectPVDriveListHandler operator_api.GetDirectPVDriveListHandler - // OperatorAPIGetDirectPVVolumeListHandler sets the operation handler for the get direct p v volume list operation - OperatorAPIGetDirectPVVolumeListHandler operator_api.GetDirectPVVolumeListHandler - // OperatorAPIGetMPIntegrationHandler sets the operation handler for the get m p integration operation - OperatorAPIGetMPIntegrationHandler operator_api.GetMPIntegrationHandler - // OperatorAPIGetMaxAllocatableMemHandler sets the operation handler for the get max allocatable mem operation - OperatorAPIGetMaxAllocatableMemHandler operator_api.GetMaxAllocatableMemHandler - // OperatorAPIGetPVCDescribeHandler sets the operation handler for the get p v c describe operation - OperatorAPIGetPVCDescribeHandler operator_api.GetPVCDescribeHandler - // OperatorAPIGetPVCEventsHandler sets the operation handler for the get p v c events operation - OperatorAPIGetPVCEventsHandler operator_api.GetPVCEventsHandler - // OperatorAPIGetParityHandler sets the operation handler for the get parity operation - OperatorAPIGetParityHandler operator_api.GetParityHandler - // OperatorAPIGetPodEventsHandler sets the operation handler for the get pod events operation - OperatorAPIGetPodEventsHandler operator_api.GetPodEventsHandler - // OperatorAPIGetPodLogsHandler sets the operation handler for the get pod logs operation - OperatorAPIGetPodLogsHandler operator_api.GetPodLogsHandler - // OperatorAPIGetResourceQuotaHandler sets the operation handler for the get resource quota operation - OperatorAPIGetResourceQuotaHandler operator_api.GetResourceQuotaHandler - // OperatorAPIGetTenantEventsHandler sets the operation handler for the get tenant events operation - OperatorAPIGetTenantEventsHandler operator_api.GetTenantEventsHandler - // OperatorAPIGetTenantLogsHandler sets the operation handler for the get tenant logs operation - OperatorAPIGetTenantLogsHandler operator_api.GetTenantLogsHandler - // OperatorAPIGetTenantMonitoringHandler sets the operation handler for the get tenant monitoring operation - OperatorAPIGetTenantMonitoringHandler operator_api.GetTenantMonitoringHandler - // OperatorAPIGetTenantPodsHandler sets the operation handler for the get tenant pods operation - OperatorAPIGetTenantPodsHandler operator_api.GetTenantPodsHandler - // OperatorAPIGetTenantUsageHandler sets the operation handler for the get tenant usage operation - OperatorAPIGetTenantUsageHandler operator_api.GetTenantUsageHandler - // OperatorAPIGetTenantYAMLHandler sets the operation handler for the get tenant y a m l operation - OperatorAPIGetTenantYAMLHandler operator_api.GetTenantYAMLHandler - // OperatorAPIListAllTenantsHandler sets the operation handler for the list all tenants operation - OperatorAPIListAllTenantsHandler operator_api.ListAllTenantsHandler - // OperatorAPIListNodeLabelsHandler sets the operation handler for the list node labels operation - OperatorAPIListNodeLabelsHandler operator_api.ListNodeLabelsHandler - // OperatorAPIListPVCsHandler sets the operation handler for the list p v cs operation - OperatorAPIListPVCsHandler operator_api.ListPVCsHandler - // OperatorAPIListPVCsForTenantHandler sets the operation handler for the list p v cs for tenant operation - OperatorAPIListPVCsForTenantHandler operator_api.ListPVCsForTenantHandler - // OperatorAPIListTenantCertificateSigningRequestHandler sets the operation handler for the list tenant certificate signing request operation - OperatorAPIListTenantCertificateSigningRequestHandler operator_api.ListTenantCertificateSigningRequestHandler - // OperatorAPIListTenantsHandler sets the operation handler for the list tenants operation - OperatorAPIListTenantsHandler operator_api.ListTenantsHandler - // AuthLoginDetailHandler sets the operation handler for the login detail operation - AuthLoginDetailHandler auth.LoginDetailHandler - // AuthLoginOauth2AuthHandler sets the operation handler for the login oauth2 auth operation - AuthLoginOauth2AuthHandler auth.LoginOauth2AuthHandler - // AuthLoginOperatorHandler sets the operation handler for the login operator operation - AuthLoginOperatorHandler auth.LoginOperatorHandler - // AuthLogoutHandler sets the operation handler for the logout operation - AuthLogoutHandler auth.LogoutHandler - // OperatorAPIOperatorSubnetAPIKeyInfoHandler sets the operation handler for the operator subnet API key info operation - OperatorAPIOperatorSubnetAPIKeyInfoHandler operator_api.OperatorSubnetAPIKeyInfoHandler - // OperatorAPIOperatorSubnetAPIKeyHandler sets the operation handler for the operator subnet Api key operation - OperatorAPIOperatorSubnetAPIKeyHandler operator_api.OperatorSubnetAPIKeyHandler - // OperatorAPIOperatorSubnetLoginHandler sets the operation handler for the operator subnet login operation - OperatorAPIOperatorSubnetLoginHandler operator_api.OperatorSubnetLoginHandler - // OperatorAPIOperatorSubnetLoginMFAHandler sets the operation handler for the operator subnet login m f a operation - OperatorAPIOperatorSubnetLoginMFAHandler operator_api.OperatorSubnetLoginMFAHandler - // OperatorAPIOperatorSubnetRegisterAPIKeyHandler sets the operation handler for the operator subnet register API key operation - OperatorAPIOperatorSubnetRegisterAPIKeyHandler operator_api.OperatorSubnetRegisterAPIKeyHandler - // OperatorAPIPostMPIntegrationHandler sets the operation handler for the post m p integration operation - OperatorAPIPostMPIntegrationHandler operator_api.PostMPIntegrationHandler - // OperatorAPIPutTenantYAMLHandler sets the operation handler for the put tenant y a m l operation - OperatorAPIPutTenantYAMLHandler operator_api.PutTenantYAMLHandler - // AuthSessionCheckHandler sets the operation handler for the session check operation - AuthSessionCheckHandler auth.SessionCheckHandler - // OperatorAPISetTenantAdministratorsHandler sets the operation handler for the set tenant administrators operation - OperatorAPISetTenantAdministratorsHandler operator_api.SetTenantAdministratorsHandler - // OperatorAPISetTenantLogsHandler sets the operation handler for the set tenant logs operation - OperatorAPISetTenantLogsHandler operator_api.SetTenantLogsHandler - // OperatorAPISetTenantMonitoringHandler sets the operation handler for the set tenant monitoring operation - OperatorAPISetTenantMonitoringHandler operator_api.SetTenantMonitoringHandler - // OperatorAPISubscriptionActivateHandler sets the operation handler for the subscription activate operation - OperatorAPISubscriptionActivateHandler operator_api.SubscriptionActivateHandler - // OperatorAPISubscriptionInfoHandler sets the operation handler for the subscription info operation - OperatorAPISubscriptionInfoHandler operator_api.SubscriptionInfoHandler - // OperatorAPISubscriptionRefreshHandler sets the operation handler for the subscription refresh operation - OperatorAPISubscriptionRefreshHandler operator_api.SubscriptionRefreshHandler - // OperatorAPISubscriptionValidateHandler sets the operation handler for the subscription validate operation - OperatorAPISubscriptionValidateHandler operator_api.SubscriptionValidateHandler - // OperatorAPITenantAddPoolHandler sets the operation handler for the tenant add pool operation - OperatorAPITenantAddPoolHandler operator_api.TenantAddPoolHandler - // OperatorAPITenantConfigurationHandler sets the operation handler for the tenant configuration operation - OperatorAPITenantConfigurationHandler operator_api.TenantConfigurationHandler - // OperatorAPITenantDeleteEncryptionHandler sets the operation handler for the tenant delete encryption operation - OperatorAPITenantDeleteEncryptionHandler operator_api.TenantDeleteEncryptionHandler - // OperatorAPITenantDetailsHandler sets the operation handler for the tenant details operation - OperatorAPITenantDetailsHandler operator_api.TenantDetailsHandler - // OperatorAPITenantEncryptionInfoHandler sets the operation handler for the tenant encryption info operation - OperatorAPITenantEncryptionInfoHandler operator_api.TenantEncryptionInfoHandler - // OperatorAPITenantIdentityProviderHandler sets the operation handler for the tenant identity provider operation - OperatorAPITenantIdentityProviderHandler operator_api.TenantIdentityProviderHandler - // OperatorAPITenantSecurityHandler sets the operation handler for the tenant security operation - OperatorAPITenantSecurityHandler operator_api.TenantSecurityHandler - // OperatorAPITenantUpdateCertificateHandler sets the operation handler for the tenant update certificate operation - OperatorAPITenantUpdateCertificateHandler operator_api.TenantUpdateCertificateHandler - // OperatorAPITenantUpdateEncryptionHandler sets the operation handler for the tenant update encryption operation - OperatorAPITenantUpdateEncryptionHandler operator_api.TenantUpdateEncryptionHandler - // OperatorAPITenantUpdatePoolsHandler sets the operation handler for the tenant update pools operation - OperatorAPITenantUpdatePoolsHandler operator_api.TenantUpdatePoolsHandler - // OperatorAPIUpdateTenantHandler sets the operation handler for the update tenant operation - OperatorAPIUpdateTenantHandler operator_api.UpdateTenantHandler - // OperatorAPIUpdateTenantConfigurationHandler sets the operation handler for the update tenant configuration operation - OperatorAPIUpdateTenantConfigurationHandler operator_api.UpdateTenantConfigurationHandler - // OperatorAPIUpdateTenantDomainsHandler sets the operation handler for the update tenant domains operation - OperatorAPIUpdateTenantDomainsHandler operator_api.UpdateTenantDomainsHandler - // OperatorAPIUpdateTenantIdentityProviderHandler sets the operation handler for the update tenant identity provider operation - OperatorAPIUpdateTenantIdentityProviderHandler operator_api.UpdateTenantIdentityProviderHandler - // OperatorAPIUpdateTenantSecurityHandler sets the operation handler for the update tenant security operation - OperatorAPIUpdateTenantSecurityHandler operator_api.UpdateTenantSecurityHandler - - // ServeError is called when an error is received, there is a default handler - // but you can set your own with this - ServeError func(http.ResponseWriter, *http.Request, error) - - // PreServerShutdown is called before the HTTP(S) server is shutdown - // This allows for custom functions to get executed before the HTTP(S) server stops accepting traffic - PreServerShutdown func() - - // ServerShutdown is called when the HTTP(S) server is shut down and done - // handling all active connections and does not accept connections any more - ServerShutdown func() - - // Custom command line argument groups with their descriptions - CommandLineOptionsGroups []swag.CommandLineOptionsGroup - - // User defined logger function. - Logger func(string, ...interface{}) -} - -// UseRedoc for documentation at /docs -func (o *OperatorAPI) UseRedoc() { - o.useSwaggerUI = false -} - -// UseSwaggerUI for documentation at /docs -func (o *OperatorAPI) UseSwaggerUI() { - o.useSwaggerUI = true -} - -// SetDefaultProduces sets the default produces media type -func (o *OperatorAPI) SetDefaultProduces(mediaType string) { - o.defaultProduces = mediaType -} - -// SetDefaultConsumes returns the default consumes media type -func (o *OperatorAPI) SetDefaultConsumes(mediaType string) { - o.defaultConsumes = mediaType -} - -// SetSpec sets a spec that will be served for the clients. -func (o *OperatorAPI) SetSpec(spec *loads.Document) { - o.spec = spec -} - -// DefaultProduces returns the default produces media type -func (o *OperatorAPI) DefaultProduces() string { - return o.defaultProduces -} - -// DefaultConsumes returns the default consumes media type -func (o *OperatorAPI) DefaultConsumes() string { - return o.defaultConsumes -} - -// Formats returns the registered string formats -func (o *OperatorAPI) Formats() strfmt.Registry { - return o.formats -} - -// RegisterFormat registers a custom format validator -func (o *OperatorAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) { - o.formats.Add(name, format, validator) -} - -// Validate validates the registrations in the OperatorAPI -func (o *OperatorAPI) Validate() error { - var unregistered []string - - if o.JSONConsumer == nil { - unregistered = append(unregistered, "JSONConsumer") - } - - if o.JSONProducer == nil { - unregistered = append(unregistered, "JSONProducer") - } - - if o.KeyAuth == nil { - unregistered = append(unregistered, "KeyAuth") - } - - if o.UserAPICheckMinIOVersionHandler == nil { - unregistered = append(unregistered, "user_api.CheckMinIOVersionHandler") - } - if o.OperatorAPICreateNamespaceHandler == nil { - unregistered = append(unregistered, "operator_api.CreateNamespaceHandler") - } - if o.OperatorAPICreateTenantHandler == nil { - unregistered = append(unregistered, "operator_api.CreateTenantHandler") - } - if o.OperatorAPIDeletePVCHandler == nil { - unregistered = append(unregistered, "operator_api.DeletePVCHandler") - } - if o.OperatorAPIDeletePodHandler == nil { - unregistered = append(unregistered, "operator_api.DeletePodHandler") - } - if o.OperatorAPIDeleteTenantHandler == nil { - unregistered = append(unregistered, "operator_api.DeleteTenantHandler") - } - if o.OperatorAPIDescribePodHandler == nil { - unregistered = append(unregistered, "operator_api.DescribePodHandler") - } - if o.OperatorAPIDirectPVFormatDriveHandler == nil { - unregistered = append(unregistered, "operator_api.DirectPVFormatDriveHandler") - } - if o.OperatorAPIDisableTenantLoggingHandler == nil { - unregistered = append(unregistered, "operator_api.DisableTenantLoggingHandler") - } - if o.OperatorAPIEnableTenantLoggingHandler == nil { - unregistered = append(unregistered, "operator_api.EnableTenantLoggingHandler") - } - if o.OperatorAPIGetAllocatableResourcesHandler == nil { - unregistered = append(unregistered, "operator_api.GetAllocatableResourcesHandler") - } - if o.OperatorAPIGetDirectPVDriveListHandler == nil { - unregistered = append(unregistered, "operator_api.GetDirectPVDriveListHandler") - } - if o.OperatorAPIGetDirectPVVolumeListHandler == nil { - unregistered = append(unregistered, "operator_api.GetDirectPVVolumeListHandler") - } - if o.OperatorAPIGetMPIntegrationHandler == nil { - unregistered = append(unregistered, "operator_api.GetMPIntegrationHandler") - } - if o.OperatorAPIGetMaxAllocatableMemHandler == nil { - unregistered = append(unregistered, "operator_api.GetMaxAllocatableMemHandler") - } - if o.OperatorAPIGetPVCDescribeHandler == nil { - unregistered = append(unregistered, "operator_api.GetPVCDescribeHandler") - } - if o.OperatorAPIGetPVCEventsHandler == nil { - unregistered = append(unregistered, "operator_api.GetPVCEventsHandler") - } - if o.OperatorAPIGetParityHandler == nil { - unregistered = append(unregistered, "operator_api.GetParityHandler") - } - if o.OperatorAPIGetPodEventsHandler == nil { - unregistered = append(unregistered, "operator_api.GetPodEventsHandler") - } - if o.OperatorAPIGetPodLogsHandler == nil { - unregistered = append(unregistered, "operator_api.GetPodLogsHandler") - } - if o.OperatorAPIGetResourceQuotaHandler == nil { - unregistered = append(unregistered, "operator_api.GetResourceQuotaHandler") - } - if o.OperatorAPIGetTenantEventsHandler == nil { - unregistered = append(unregistered, "operator_api.GetTenantEventsHandler") - } - if o.OperatorAPIGetTenantLogsHandler == nil { - unregistered = append(unregistered, "operator_api.GetTenantLogsHandler") - } - if o.OperatorAPIGetTenantMonitoringHandler == nil { - unregistered = append(unregistered, "operator_api.GetTenantMonitoringHandler") - } - if o.OperatorAPIGetTenantPodsHandler == nil { - unregistered = append(unregistered, "operator_api.GetTenantPodsHandler") - } - if o.OperatorAPIGetTenantUsageHandler == nil { - unregistered = append(unregistered, "operator_api.GetTenantUsageHandler") - } - if o.OperatorAPIGetTenantYAMLHandler == nil { - unregistered = append(unregistered, "operator_api.GetTenantYAMLHandler") - } - if o.OperatorAPIListAllTenantsHandler == nil { - unregistered = append(unregistered, "operator_api.ListAllTenantsHandler") - } - if o.OperatorAPIListNodeLabelsHandler == nil { - unregistered = append(unregistered, "operator_api.ListNodeLabelsHandler") - } - if o.OperatorAPIListPVCsHandler == nil { - unregistered = append(unregistered, "operator_api.ListPVCsHandler") - } - if o.OperatorAPIListPVCsForTenantHandler == nil { - unregistered = append(unregistered, "operator_api.ListPVCsForTenantHandler") - } - if o.OperatorAPIListTenantCertificateSigningRequestHandler == nil { - unregistered = append(unregistered, "operator_api.ListTenantCertificateSigningRequestHandler") - } - if o.OperatorAPIListTenantsHandler == nil { - unregistered = append(unregistered, "operator_api.ListTenantsHandler") - } - if o.AuthLoginDetailHandler == nil { - unregistered = append(unregistered, "auth.LoginDetailHandler") - } - if o.AuthLoginOauth2AuthHandler == nil { - unregistered = append(unregistered, "auth.LoginOauth2AuthHandler") - } - if o.AuthLoginOperatorHandler == nil { - unregistered = append(unregistered, "auth.LoginOperatorHandler") - } - if o.AuthLogoutHandler == nil { - unregistered = append(unregistered, "auth.LogoutHandler") - } - if o.OperatorAPIOperatorSubnetAPIKeyInfoHandler == nil { - unregistered = append(unregistered, "operator_api.OperatorSubnetAPIKeyInfoHandler") - } - if o.OperatorAPIOperatorSubnetAPIKeyHandler == nil { - unregistered = append(unregistered, "operator_api.OperatorSubnetAPIKeyHandler") - } - if o.OperatorAPIOperatorSubnetLoginHandler == nil { - unregistered = append(unregistered, "operator_api.OperatorSubnetLoginHandler") - } - if o.OperatorAPIOperatorSubnetLoginMFAHandler == nil { - unregistered = append(unregistered, "operator_api.OperatorSubnetLoginMFAHandler") - } - if o.OperatorAPIOperatorSubnetRegisterAPIKeyHandler == nil { - unregistered = append(unregistered, "operator_api.OperatorSubnetRegisterAPIKeyHandler") - } - if o.OperatorAPIPostMPIntegrationHandler == nil { - unregistered = append(unregistered, "operator_api.PostMPIntegrationHandler") - } - if o.OperatorAPIPutTenantYAMLHandler == nil { - unregistered = append(unregistered, "operator_api.PutTenantYAMLHandler") - } - if o.AuthSessionCheckHandler == nil { - unregistered = append(unregistered, "auth.SessionCheckHandler") - } - if o.OperatorAPISetTenantAdministratorsHandler == nil { - unregistered = append(unregistered, "operator_api.SetTenantAdministratorsHandler") - } - if o.OperatorAPISetTenantLogsHandler == nil { - unregistered = append(unregistered, "operator_api.SetTenantLogsHandler") - } - if o.OperatorAPISetTenantMonitoringHandler == nil { - unregistered = append(unregistered, "operator_api.SetTenantMonitoringHandler") - } - if o.OperatorAPISubscriptionActivateHandler == nil { - unregistered = append(unregistered, "operator_api.SubscriptionActivateHandler") - } - if o.OperatorAPISubscriptionInfoHandler == nil { - unregistered = append(unregistered, "operator_api.SubscriptionInfoHandler") - } - if o.OperatorAPISubscriptionRefreshHandler == nil { - unregistered = append(unregistered, "operator_api.SubscriptionRefreshHandler") - } - if o.OperatorAPISubscriptionValidateHandler == nil { - unregistered = append(unregistered, "operator_api.SubscriptionValidateHandler") - } - if o.OperatorAPITenantAddPoolHandler == nil { - unregistered = append(unregistered, "operator_api.TenantAddPoolHandler") - } - if o.OperatorAPITenantConfigurationHandler == nil { - unregistered = append(unregistered, "operator_api.TenantConfigurationHandler") - } - if o.OperatorAPITenantDeleteEncryptionHandler == nil { - unregistered = append(unregistered, "operator_api.TenantDeleteEncryptionHandler") - } - if o.OperatorAPITenantDetailsHandler == nil { - unregistered = append(unregistered, "operator_api.TenantDetailsHandler") - } - if o.OperatorAPITenantEncryptionInfoHandler == nil { - unregistered = append(unregistered, "operator_api.TenantEncryptionInfoHandler") - } - if o.OperatorAPITenantIdentityProviderHandler == nil { - unregistered = append(unregistered, "operator_api.TenantIdentityProviderHandler") - } - if o.OperatorAPITenantSecurityHandler == nil { - unregistered = append(unregistered, "operator_api.TenantSecurityHandler") - } - if o.OperatorAPITenantUpdateCertificateHandler == nil { - unregistered = append(unregistered, "operator_api.TenantUpdateCertificateHandler") - } - if o.OperatorAPITenantUpdateEncryptionHandler == nil { - unregistered = append(unregistered, "operator_api.TenantUpdateEncryptionHandler") - } - if o.OperatorAPITenantUpdatePoolsHandler == nil { - unregistered = append(unregistered, "operator_api.TenantUpdatePoolsHandler") - } - if o.OperatorAPIUpdateTenantHandler == nil { - unregistered = append(unregistered, "operator_api.UpdateTenantHandler") - } - if o.OperatorAPIUpdateTenantConfigurationHandler == nil { - unregistered = append(unregistered, "operator_api.UpdateTenantConfigurationHandler") - } - if o.OperatorAPIUpdateTenantDomainsHandler == nil { - unregistered = append(unregistered, "operator_api.UpdateTenantDomainsHandler") - } - if o.OperatorAPIUpdateTenantIdentityProviderHandler == nil { - unregistered = append(unregistered, "operator_api.UpdateTenantIdentityProviderHandler") - } - if o.OperatorAPIUpdateTenantSecurityHandler == nil { - unregistered = append(unregistered, "operator_api.UpdateTenantSecurityHandler") - } - - if len(unregistered) > 0 { - return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", ")) - } - - return nil -} - -// ServeErrorFor gets a error handler for a given operation id -func (o *OperatorAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error) { - return o.ServeError -} - -// AuthenticatorsFor gets the authenticators for the specified security schemes -func (o *OperatorAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator { - result := make(map[string]runtime.Authenticator) - for name := range schemes { - switch name { - case "key": - result[name] = o.BearerAuthenticator(name, func(token string, scopes []string) (interface{}, error) { - return o.KeyAuth(token, scopes) - }) - - } - } - return result -} - -// Authorizer returns the registered authorizer -func (o *OperatorAPI) Authorizer() runtime.Authorizer { - return o.APIAuthorizer -} - -// ConsumersFor gets the consumers for the specified media types. -// MIME type parameters are ignored here. -func (o *OperatorAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer { - result := make(map[string]runtime.Consumer, len(mediaTypes)) - for _, mt := range mediaTypes { - switch mt { - case "application/json": - result["application/json"] = o.JSONConsumer - } - - if c, ok := o.customConsumers[mt]; ok { - result[mt] = c - } - } - return result -} - -// ProducersFor gets the producers for the specified media types. -// MIME type parameters are ignored here. -func (o *OperatorAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer { - result := make(map[string]runtime.Producer, len(mediaTypes)) - for _, mt := range mediaTypes { - switch mt { - case "application/json": - result["application/json"] = o.JSONProducer - } - - if p, ok := o.customProducers[mt]; ok { - result[mt] = p - } - } - return result -} - -// HandlerFor gets a http.Handler for the provided operation method and path -func (o *OperatorAPI) HandlerFor(method, path string) (http.Handler, bool) { - if o.handlers == nil { - return nil, false - } - um := strings.ToUpper(method) - if _, ok := o.handlers[um]; !ok { - return nil, false - } - if path == "/" { - path = "" - } - h, ok := o.handlers[um][path] - return h, ok -} - -// Context returns the middleware context for the operator API -func (o *OperatorAPI) Context() *middleware.Context { - if o.context == nil { - o.context = middleware.NewRoutableContext(o.spec, o, nil) - } - - return o.context -} - -func (o *OperatorAPI) initHandlerCache() { - o.Context() // don't care about the result, just that the initialization happened - if o.handlers == nil { - o.handlers = make(map[string]map[string]http.Handler) - } - - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/check-version"] = user_api.NewCheckMinIOVersion(o.context, o.UserAPICheckMinIOVersionHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/namespace"] = operator_api.NewCreateNamespace(o.context, o.OperatorAPICreateNamespaceHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/tenants"] = operator_api.NewCreateTenant(o.context, o.OperatorAPICreateTenantHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/namespaces/{namespace}/tenants/{tenant}/pvc/{PVCName}"] = operator_api.NewDeletePVC(o.context, o.OperatorAPIDeletePVCHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/namespaces/{namespace}/tenants/{tenant}/pods/{podName}"] = operator_api.NewDeletePod(o.context, o.OperatorAPIDeletePodHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/namespaces/{namespace}/tenants/{tenant}"] = operator_api.NewDeleteTenant(o.context, o.OperatorAPIDeleteTenantHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/pods/{podName}/describe"] = operator_api.NewDescribePod(o.context, o.OperatorAPIDescribePodHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/directpv/drives/format"] = operator_api.NewDirectPVFormatDrive(o.context, o.OperatorAPIDirectPVFormatDriveHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/namespaces/{namespace}/tenants/{tenant}/disable-logging"] = operator_api.NewDisableTenantLogging(o.context, o.OperatorAPIDisableTenantLoggingHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/namespaces/{namespace}/tenants/{tenant}/enable-logging"] = operator_api.NewEnableTenantLogging(o.context, o.OperatorAPIEnableTenantLoggingHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/cluster/allocatable-resources"] = operator_api.NewGetAllocatableResources(o.context, o.OperatorAPIGetAllocatableResourcesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/directpv/drives"] = operator_api.NewGetDirectPVDriveList(o.context, o.OperatorAPIGetDirectPVDriveListHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/directpv/volumes"] = operator_api.NewGetDirectPVVolumeList(o.context, o.OperatorAPIGetDirectPVVolumeListHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/mp-integration"] = operator_api.NewGetMPIntegration(o.context, o.OperatorAPIGetMPIntegrationHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/cluster/max-allocatable-memory"] = operator_api.NewGetMaxAllocatableMem(o.context, o.OperatorAPIGetMaxAllocatableMemHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/pvcs/{PVCName}/describe"] = operator_api.NewGetPVCDescribe(o.context, o.OperatorAPIGetPVCDescribeHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/pvcs/{PVCName}/events"] = operator_api.NewGetPVCEvents(o.context, o.OperatorAPIGetPVCEventsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/get-parity/{nodes}/{disksPerNode}"] = operator_api.NewGetParity(o.context, o.OperatorAPIGetParityHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/pods/{podName}/events"] = operator_api.NewGetPodEvents(o.context, o.OperatorAPIGetPodEventsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/pods/{podName}"] = operator_api.NewGetPodLogs(o.context, o.OperatorAPIGetPodLogsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/resourcequotas/{resource-quota-name}"] = operator_api.NewGetResourceQuota(o.context, o.OperatorAPIGetResourceQuotaHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/events"] = operator_api.NewGetTenantEvents(o.context, o.OperatorAPIGetTenantEventsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/log"] = operator_api.NewGetTenantLogs(o.context, o.OperatorAPIGetTenantLogsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/monitoring"] = operator_api.NewGetTenantMonitoring(o.context, o.OperatorAPIGetTenantMonitoringHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/pods"] = operator_api.NewGetTenantPods(o.context, o.OperatorAPIGetTenantPodsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/usage"] = operator_api.NewGetTenantUsage(o.context, o.OperatorAPIGetTenantUsageHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/yaml"] = operator_api.NewGetTenantYAML(o.context, o.OperatorAPIGetTenantYAMLHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/tenants"] = operator_api.NewListAllTenants(o.context, o.OperatorAPIListAllTenantsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/nodes/labels"] = operator_api.NewListNodeLabels(o.context, o.OperatorAPIListNodeLabelsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/list-pvcs"] = operator_api.NewListPVCs(o.context, o.OperatorAPIListPVCsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/pvcs"] = operator_api.NewListPVCsForTenant(o.context, o.OperatorAPIListPVCsForTenantHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/csr"] = operator_api.NewListTenantCertificateSigningRequest(o.context, o.OperatorAPIListTenantCertificateSigningRequestHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants"] = operator_api.NewListTenants(o.context, o.OperatorAPIListTenantsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/login"] = auth.NewLoginDetail(o.context, o.AuthLoginDetailHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/login/oauth2/auth"] = auth.NewLoginOauth2Auth(o.context, o.AuthLoginOauth2AuthHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/login/operator"] = auth.NewLoginOperator(o.context, o.AuthLoginOperatorHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/logout"] = auth.NewLogout(o.context, o.AuthLogoutHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/subnet/apikey/info"] = operator_api.NewOperatorSubnetAPIKeyInfo(o.context, o.OperatorAPIOperatorSubnetAPIKeyInfoHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/subnet/apikey"] = operator_api.NewOperatorSubnetAPIKey(o.context, o.OperatorAPIOperatorSubnetAPIKeyHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/subnet/login"] = operator_api.NewOperatorSubnetLogin(o.context, o.OperatorAPIOperatorSubnetLoginHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/subnet/login/mfa"] = operator_api.NewOperatorSubnetLoginMFA(o.context, o.OperatorAPIOperatorSubnetLoginMFAHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/subnet/apikey/register"] = operator_api.NewOperatorSubnetRegisterAPIKey(o.context, o.OperatorAPIOperatorSubnetRegisterAPIKeyHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/mp-integration"] = operator_api.NewPostMPIntegration(o.context, o.OperatorAPIPostMPIntegrationHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/namespaces/{namespace}/tenants/{tenant}/yaml"] = operator_api.NewPutTenantYAML(o.context, o.OperatorAPIPutTenantYAMLHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/session"] = auth.NewSessionCheck(o.context, o.AuthSessionCheckHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/namespaces/{namespace}/tenants/{tenant}/set-administrators"] = operator_api.NewSetTenantAdministrators(o.context, o.OperatorAPISetTenantAdministratorsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/namespaces/{namespace}/tenants/{tenant}/log"] = operator_api.NewSetTenantLogs(o.context, o.OperatorAPISetTenantLogsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/namespaces/{namespace}/tenants/{tenant}/monitoring"] = operator_api.NewSetTenantMonitoring(o.context, o.OperatorAPISetTenantMonitoringHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/subscription/namespaces/{namespace}/tenants/{tenant}/activate"] = operator_api.NewSubscriptionActivate(o.context, o.OperatorAPISubscriptionActivateHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/subscription/info"] = operator_api.NewSubscriptionInfo(o.context, o.OperatorAPISubscriptionInfoHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/subscription/refresh"] = operator_api.NewSubscriptionRefresh(o.context, o.OperatorAPISubscriptionRefreshHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/subscription/validate"] = operator_api.NewSubscriptionValidate(o.context, o.OperatorAPISubscriptionValidateHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/namespaces/{namespace}/tenants/{tenant}/pools"] = operator_api.NewTenantAddPool(o.context, o.OperatorAPITenantAddPoolHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/configuration"] = operator_api.NewTenantConfiguration(o.context, o.OperatorAPITenantConfigurationHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/namespaces/{namespace}/tenants/{tenant}/encryption"] = operator_api.NewTenantDeleteEncryption(o.context, o.OperatorAPITenantDeleteEncryptionHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}"] = operator_api.NewTenantDetails(o.context, o.OperatorAPITenantDetailsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/encryption"] = operator_api.NewTenantEncryptionInfo(o.context, o.OperatorAPITenantEncryptionInfoHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/identity-provider"] = operator_api.NewTenantIdentityProvider(o.context, o.OperatorAPITenantIdentityProviderHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/security"] = operator_api.NewTenantSecurity(o.context, o.OperatorAPITenantSecurityHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/namespaces/{namespace}/tenants/{tenant}/certificates"] = operator_api.NewTenantUpdateCertificate(o.context, o.OperatorAPITenantUpdateCertificateHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/namespaces/{namespace}/tenants/{tenant}/encryption"] = operator_api.NewTenantUpdateEncryption(o.context, o.OperatorAPITenantUpdateEncryptionHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/namespaces/{namespace}/tenants/{tenant}/pools"] = operator_api.NewTenantUpdatePools(o.context, o.OperatorAPITenantUpdatePoolsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/namespaces/{namespace}/tenants/{tenant}"] = operator_api.NewUpdateTenant(o.context, o.OperatorAPIUpdateTenantHandler) - if o.handlers["PATCH"] == nil { - o.handlers["PATCH"] = make(map[string]http.Handler) - } - o.handlers["PATCH"]["/namespaces/{namespace}/tenants/{tenant}/configuration"] = operator_api.NewUpdateTenantConfiguration(o.context, o.OperatorAPIUpdateTenantConfigurationHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/namespaces/{namespace}/tenants/{tenant}/domains"] = operator_api.NewUpdateTenantDomains(o.context, o.OperatorAPIUpdateTenantDomainsHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/namespaces/{namespace}/tenants/{tenant}/identity-provider"] = operator_api.NewUpdateTenantIdentityProvider(o.context, o.OperatorAPIUpdateTenantIdentityProviderHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/namespaces/{namespace}/tenants/{tenant}/security"] = operator_api.NewUpdateTenantSecurity(o.context, o.OperatorAPIUpdateTenantSecurityHandler) -} - -// Serve creates a http handler to serve the API over HTTP -// can be used directly in http.ListenAndServe(":8000", api.Serve(nil)) -func (o *OperatorAPI) Serve(builder middleware.Builder) http.Handler { - o.Init() - - if o.Middleware != nil { - return o.Middleware(builder) - } - if o.useSwaggerUI { - return o.context.APIHandlerSwaggerUI(builder) - } - return o.context.APIHandler(builder) -} - -// Init allows you to just initialize the handler cache, you can then recompose the middleware as you see fit -func (o *OperatorAPI) Init() { - if len(o.handlers) == 0 { - o.initHandlerCache() - } -} - -// RegisterConsumer allows you to add (or override) a consumer for a media type. -func (o *OperatorAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer) { - o.customConsumers[mediaType] = consumer -} - -// RegisterProducer allows you to add (or override) a producer for a media type. -func (o *OperatorAPI) RegisterProducer(mediaType string, producer runtime.Producer) { - o.customProducers[mediaType] = producer -} - -// AddMiddlewareFor adds a http middleware to existing handler -func (o *OperatorAPI) AddMiddlewareFor(method, path string, builder middleware.Builder) { - um := strings.ToUpper(method) - if path == "/" { - path = "" - } - o.Init() - if h, ok := o.handlers[um][path]; ok { - o.handlers[method][path] = builder(h) - } -} diff --git a/operatorapi/operations/operator_api/create_namespace.go b/operatorapi/operations/operator_api/create_namespace.go deleted file mode 100644 index 4fe421614..000000000 --- a/operatorapi/operations/operator_api/create_namespace.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// CreateNamespaceHandlerFunc turns a function with the right signature into a create namespace handler -type CreateNamespaceHandlerFunc func(CreateNamespaceParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateNamespaceHandlerFunc) Handle(params CreateNamespaceParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// CreateNamespaceHandler interface for that can handle valid create namespace params -type CreateNamespaceHandler interface { - Handle(CreateNamespaceParams, *models.Principal) middleware.Responder -} - -// NewCreateNamespace creates a new http.Handler for the create namespace operation -func NewCreateNamespace(ctx *middleware.Context, handler CreateNamespaceHandler) *CreateNamespace { - return &CreateNamespace{Context: ctx, Handler: handler} -} - -/* - CreateNamespace swagger:route POST /namespace OperatorAPI createNamespace - -Creates a new Namespace with given information -*/ -type CreateNamespace struct { - Context *middleware.Context - Handler CreateNamespaceHandler -} - -func (o *CreateNamespace) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateNamespaceParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/create_namespace_parameters.go b/operatorapi/operations/operator_api/create_namespace_parameters.go deleted file mode 100644 index 0db178f63..000000000 --- a/operatorapi/operations/operator_api/create_namespace_parameters.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewCreateNamespaceParams creates a new CreateNamespaceParams object -// -// There are no default values defined in the spec. -func NewCreateNamespaceParams() CreateNamespaceParams { - - return CreateNamespaceParams{} -} - -// CreateNamespaceParams contains all the bound params for the create namespace operation -// typically these are obtained from a http.Request -// -// swagger:parameters CreateNamespace -type CreateNamespaceParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.Namespace -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateNamespaceParams() beforehand. -func (o *CreateNamespaceParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Namespace - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/operator_api/create_namespace_responses.go b/operatorapi/operations/operator_api/create_namespace_responses.go deleted file mode 100644 index 8ac7e4bad..000000000 --- a/operatorapi/operations/operator_api/create_namespace_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// CreateNamespaceCreatedCode is the HTTP code returned for type CreateNamespaceCreated -const CreateNamespaceCreatedCode int = 201 - -/* -CreateNamespaceCreated A successful response. - -swagger:response createNamespaceCreated -*/ -type CreateNamespaceCreated struct { -} - -// NewCreateNamespaceCreated creates CreateNamespaceCreated with default headers values -func NewCreateNamespaceCreated() *CreateNamespaceCreated { - - return &CreateNamespaceCreated{} -} - -// WriteResponse to the client -func (o *CreateNamespaceCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -/* -CreateNamespaceDefault Generic error response. - -swagger:response createNamespaceDefault -*/ -type CreateNamespaceDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateNamespaceDefault creates CreateNamespaceDefault with default headers values -func NewCreateNamespaceDefault(code int) *CreateNamespaceDefault { - if code <= 0 { - code = 500 - } - - return &CreateNamespaceDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create namespace default response -func (o *CreateNamespaceDefault) WithStatusCode(code int) *CreateNamespaceDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create namespace default response -func (o *CreateNamespaceDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the create namespace default response -func (o *CreateNamespaceDefault) WithPayload(payload *models.Error) *CreateNamespaceDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create namespace default response -func (o *CreateNamespaceDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateNamespaceDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/create_namespace_urlbuilder.go b/operatorapi/operations/operator_api/create_namespace_urlbuilder.go deleted file mode 100644 index 54056f4bc..000000000 --- a/operatorapi/operations/operator_api/create_namespace_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// CreateNamespaceURL generates an URL for the create namespace operation -type CreateNamespaceURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateNamespaceURL) WithBasePath(bp string) *CreateNamespaceURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateNamespaceURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateNamespaceURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespace" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateNamespaceURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateNamespaceURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateNamespaceURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateNamespaceURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateNamespaceURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateNamespaceURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/create_tenant.go b/operatorapi/operations/operator_api/create_tenant.go deleted file mode 100644 index bcf40e7b4..000000000 --- a/operatorapi/operations/operator_api/create_tenant.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// CreateTenantHandlerFunc turns a function with the right signature into a create tenant handler -type CreateTenantHandlerFunc func(CreateTenantParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateTenantHandlerFunc) Handle(params CreateTenantParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// CreateTenantHandler interface for that can handle valid create tenant params -type CreateTenantHandler interface { - Handle(CreateTenantParams, *models.Principal) middleware.Responder -} - -// NewCreateTenant creates a new http.Handler for the create tenant operation -func NewCreateTenant(ctx *middleware.Context, handler CreateTenantHandler) *CreateTenant { - return &CreateTenant{Context: ctx, Handler: handler} -} - -/* - CreateTenant swagger:route POST /tenants OperatorAPI createTenant - -Create Tenant -*/ -type CreateTenant struct { - Context *middleware.Context - Handler CreateTenantHandler -} - -func (o *CreateTenant) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateTenantParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/create_tenant_parameters.go b/operatorapi/operations/operator_api/create_tenant_parameters.go deleted file mode 100644 index acc3e3948..000000000 --- a/operatorapi/operations/operator_api/create_tenant_parameters.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewCreateTenantParams creates a new CreateTenantParams object -// -// There are no default values defined in the spec. -func NewCreateTenantParams() CreateTenantParams { - - return CreateTenantParams{} -} - -// CreateTenantParams contains all the bound params for the create tenant operation -// typically these are obtained from a http.Request -// -// swagger:parameters CreateTenant -type CreateTenantParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.CreateTenantRequest -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateTenantParams() beforehand. -func (o *CreateTenantParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.CreateTenantRequest - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/operator_api/create_tenant_responses.go b/operatorapi/operations/operator_api/create_tenant_responses.go deleted file mode 100644 index 4c9d829a9..000000000 --- a/operatorapi/operations/operator_api/create_tenant_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// CreateTenantOKCode is the HTTP code returned for type CreateTenantOK -const CreateTenantOKCode int = 200 - -/* -CreateTenantOK A successful response. - -swagger:response createTenantOK -*/ -type CreateTenantOK struct { - - /* - In: Body - */ - Payload *models.CreateTenantResponse `json:"body,omitempty"` -} - -// NewCreateTenantOK creates CreateTenantOK with default headers values -func NewCreateTenantOK() *CreateTenantOK { - - return &CreateTenantOK{} -} - -// WithPayload adds the payload to the create tenant o k response -func (o *CreateTenantOK) WithPayload(payload *models.CreateTenantResponse) *CreateTenantOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create tenant o k response -func (o *CreateTenantOK) SetPayload(payload *models.CreateTenantResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTenantOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateTenantDefault Generic error response. - -swagger:response createTenantDefault -*/ -type CreateTenantDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTenantDefault creates CreateTenantDefault with default headers values -func NewCreateTenantDefault(code int) *CreateTenantDefault { - if code <= 0 { - code = 500 - } - - return &CreateTenantDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create tenant default response -func (o *CreateTenantDefault) WithStatusCode(code int) *CreateTenantDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create tenant default response -func (o *CreateTenantDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the create tenant default response -func (o *CreateTenantDefault) WithPayload(payload *models.Error) *CreateTenantDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create tenant default response -func (o *CreateTenantDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTenantDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/create_tenant_urlbuilder.go b/operatorapi/operations/operator_api/create_tenant_urlbuilder.go deleted file mode 100644 index 2379a107f..000000000 --- a/operatorapi/operations/operator_api/create_tenant_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// CreateTenantURL generates an URL for the create tenant operation -type CreateTenantURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTenantURL) WithBasePath(bp string) *CreateTenantURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTenantURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateTenantURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/tenants" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateTenantURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateTenantURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateTenantURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateTenantURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateTenantURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateTenantURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/delete_p_v_c.go b/operatorapi/operations/operator_api/delete_p_v_c.go deleted file mode 100644 index ad193375e..000000000 --- a/operatorapi/operations/operator_api/delete_p_v_c.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// DeletePVCHandlerFunc turns a function with the right signature into a delete p v c handler -type DeletePVCHandlerFunc func(DeletePVCParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeletePVCHandlerFunc) Handle(params DeletePVCParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DeletePVCHandler interface for that can handle valid delete p v c params -type DeletePVCHandler interface { - Handle(DeletePVCParams, *models.Principal) middleware.Responder -} - -// NewDeletePVC creates a new http.Handler for the delete p v c operation -func NewDeletePVC(ctx *middleware.Context, handler DeletePVCHandler) *DeletePVC { - return &DeletePVC{Context: ctx, Handler: handler} -} - -/* - DeletePVC swagger:route DELETE /namespaces/{namespace}/tenants/{tenant}/pvc/{PVCName} OperatorAPI deletePVC - -Delete PVC -*/ -type DeletePVC struct { - Context *middleware.Context - Handler DeletePVCHandler -} - -func (o *DeletePVC) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeletePVCParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/delete_p_v_c_parameters.go b/operatorapi/operations/operator_api/delete_p_v_c_parameters.go deleted file mode 100644 index 5a45f3fbf..000000000 --- a/operatorapi/operations/operator_api/delete_p_v_c_parameters.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewDeletePVCParams creates a new DeletePVCParams object -// -// There are no default values defined in the spec. -func NewDeletePVCParams() DeletePVCParams { - - return DeletePVCParams{} -} - -// DeletePVCParams contains all the bound params for the delete p v c operation -// typically these are obtained from a http.Request -// -// swagger:parameters DeletePVC -type DeletePVCParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - PVCName string - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeletePVCParams() beforehand. -func (o *DeletePVCParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rPVCName, rhkPVCName, _ := route.Params.GetOK("PVCName") - if err := o.bindPVCName(rPVCName, rhkPVCName, route.Formats); err != nil { - res = append(res, err) - } - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindPVCName binds and validates parameter PVCName from path. -func (o *DeletePVCParams) bindPVCName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.PVCName = raw - - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *DeletePVCParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *DeletePVCParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/delete_p_v_c_responses.go b/operatorapi/operations/operator_api/delete_p_v_c_responses.go deleted file mode 100644 index 8270b78ad..000000000 --- a/operatorapi/operations/operator_api/delete_p_v_c_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// DeletePVCNoContentCode is the HTTP code returned for type DeletePVCNoContent -const DeletePVCNoContentCode int = 204 - -/* -DeletePVCNoContent A successful response. - -swagger:response deletePVCNoContent -*/ -type DeletePVCNoContent struct { -} - -// NewDeletePVCNoContent creates DeletePVCNoContent with default headers values -func NewDeletePVCNoContent() *DeletePVCNoContent { - - return &DeletePVCNoContent{} -} - -// WriteResponse to the client -func (o *DeletePVCNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -DeletePVCDefault Generic error response. - -swagger:response deletePVCDefault -*/ -type DeletePVCDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeletePVCDefault creates DeletePVCDefault with default headers values -func NewDeletePVCDefault(code int) *DeletePVCDefault { - if code <= 0 { - code = 500 - } - - return &DeletePVCDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete p v c default response -func (o *DeletePVCDefault) WithStatusCode(code int) *DeletePVCDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete p v c default response -func (o *DeletePVCDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the delete p v c default response -func (o *DeletePVCDefault) WithPayload(payload *models.Error) *DeletePVCDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete p v c default response -func (o *DeletePVCDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeletePVCDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/delete_p_v_c_urlbuilder.go b/operatorapi/operations/operator_api/delete_p_v_c_urlbuilder.go deleted file mode 100644 index 23798405a..000000000 --- a/operatorapi/operations/operator_api/delete_p_v_c_urlbuilder.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// DeletePVCURL generates an URL for the delete p v c operation -type DeletePVCURL struct { - PVCName string - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeletePVCURL) WithBasePath(bp string) *DeletePVCURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeletePVCURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeletePVCURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/pvc/{PVCName}" - - pVCName := o.PVCName - if pVCName != "" { - _path = strings.Replace(_path, "{PVCName}", pVCName, -1) - } else { - return nil, errors.New("pVCName is required on DeletePVCURL") - } - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on DeletePVCURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on DeletePVCURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeletePVCURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeletePVCURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeletePVCURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeletePVCURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeletePVCURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeletePVCURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/delete_pod.go b/operatorapi/operations/operator_api/delete_pod.go deleted file mode 100644 index 7e52e3262..000000000 --- a/operatorapi/operations/operator_api/delete_pod.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// DeletePodHandlerFunc turns a function with the right signature into a delete pod handler -type DeletePodHandlerFunc func(DeletePodParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeletePodHandlerFunc) Handle(params DeletePodParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DeletePodHandler interface for that can handle valid delete pod params -type DeletePodHandler interface { - Handle(DeletePodParams, *models.Principal) middleware.Responder -} - -// NewDeletePod creates a new http.Handler for the delete pod operation -func NewDeletePod(ctx *middleware.Context, handler DeletePodHandler) *DeletePod { - return &DeletePod{Context: ctx, Handler: handler} -} - -/* - DeletePod swagger:route DELETE /namespaces/{namespace}/tenants/{tenant}/pods/{podName} OperatorAPI deletePod - -Delete pod -*/ -type DeletePod struct { - Context *middleware.Context - Handler DeletePodHandler -} - -func (o *DeletePod) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeletePodParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/delete_pod_parameters.go b/operatorapi/operations/operator_api/delete_pod_parameters.go deleted file mode 100644 index 5d0f5dd65..000000000 --- a/operatorapi/operations/operator_api/delete_pod_parameters.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewDeletePodParams creates a new DeletePodParams object -// -// There are no default values defined in the spec. -func NewDeletePodParams() DeletePodParams { - - return DeletePodParams{} -} - -// DeletePodParams contains all the bound params for the delete pod operation -// typically these are obtained from a http.Request -// -// swagger:parameters DeletePod -type DeletePodParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - PodName string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeletePodParams() beforehand. -func (o *DeletePodParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rPodName, rhkPodName, _ := route.Params.GetOK("podName") - if err := o.bindPodName(rPodName, rhkPodName, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *DeletePodParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindPodName binds and validates parameter PodName from path. -func (o *DeletePodParams) bindPodName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.PodName = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *DeletePodParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/delete_pod_responses.go b/operatorapi/operations/operator_api/delete_pod_responses.go deleted file mode 100644 index 7fe9ade08..000000000 --- a/operatorapi/operations/operator_api/delete_pod_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// DeletePodNoContentCode is the HTTP code returned for type DeletePodNoContent -const DeletePodNoContentCode int = 204 - -/* -DeletePodNoContent A successful response. - -swagger:response deletePodNoContent -*/ -type DeletePodNoContent struct { -} - -// NewDeletePodNoContent creates DeletePodNoContent with default headers values -func NewDeletePodNoContent() *DeletePodNoContent { - - return &DeletePodNoContent{} -} - -// WriteResponse to the client -func (o *DeletePodNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -DeletePodDefault Generic error response. - -swagger:response deletePodDefault -*/ -type DeletePodDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeletePodDefault creates DeletePodDefault with default headers values -func NewDeletePodDefault(code int) *DeletePodDefault { - if code <= 0 { - code = 500 - } - - return &DeletePodDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete pod default response -func (o *DeletePodDefault) WithStatusCode(code int) *DeletePodDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete pod default response -func (o *DeletePodDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the delete pod default response -func (o *DeletePodDefault) WithPayload(payload *models.Error) *DeletePodDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete pod default response -func (o *DeletePodDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeletePodDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/delete_pod_urlbuilder.go b/operatorapi/operations/operator_api/delete_pod_urlbuilder.go deleted file mode 100644 index ec241b796..000000000 --- a/operatorapi/operations/operator_api/delete_pod_urlbuilder.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// DeletePodURL generates an URL for the delete pod operation -type DeletePodURL struct { - Namespace string - PodName string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeletePodURL) WithBasePath(bp string) *DeletePodURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeletePodURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeletePodURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/pods/{podName}" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on DeletePodURL") - } - - podName := o.PodName - if podName != "" { - _path = strings.Replace(_path, "{podName}", podName, -1) - } else { - return nil, errors.New("podName is required on DeletePodURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on DeletePodURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeletePodURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeletePodURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeletePodURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeletePodURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeletePodURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeletePodURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/delete_tenant.go b/operatorapi/operations/operator_api/delete_tenant.go deleted file mode 100644 index 6ed173026..000000000 --- a/operatorapi/operations/operator_api/delete_tenant.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// DeleteTenantHandlerFunc turns a function with the right signature into a delete tenant handler -type DeleteTenantHandlerFunc func(DeleteTenantParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteTenantHandlerFunc) Handle(params DeleteTenantParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DeleteTenantHandler interface for that can handle valid delete tenant params -type DeleteTenantHandler interface { - Handle(DeleteTenantParams, *models.Principal) middleware.Responder -} - -// NewDeleteTenant creates a new http.Handler for the delete tenant operation -func NewDeleteTenant(ctx *middleware.Context, handler DeleteTenantHandler) *DeleteTenant { - return &DeleteTenant{Context: ctx, Handler: handler} -} - -/* - DeleteTenant swagger:route DELETE /namespaces/{namespace}/tenants/{tenant} OperatorAPI deleteTenant - -Delete tenant and underlying pvcs -*/ -type DeleteTenant struct { - Context *middleware.Context - Handler DeleteTenantHandler -} - -func (o *DeleteTenant) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteTenantParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/delete_tenant_parameters.go b/operatorapi/operations/operator_api/delete_tenant_parameters.go deleted file mode 100644 index 6c6ac2ef1..000000000 --- a/operatorapi/operations/operator_api/delete_tenant_parameters.go +++ /dev/null @@ -1,142 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewDeleteTenantParams creates a new DeleteTenantParams object -// -// There are no default values defined in the spec. -func NewDeleteTenantParams() DeleteTenantParams { - - return DeleteTenantParams{} -} - -// DeleteTenantParams contains all the bound params for the delete tenant operation -// typically these are obtained from a http.Request -// -// swagger:parameters DeleteTenant -type DeleteTenantParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - In: body - */ - Body *models.DeleteTenantRequest - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteTenantParams() beforehand. -func (o *DeleteTenantParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.DeleteTenantRequest - if err := route.Consumer.Consume(r.Body, &body); err != nil { - res = append(res, errors.NewParseError("body", "body", "", err)) - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *DeleteTenantParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *DeleteTenantParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/delete_tenant_responses.go b/operatorapi/operations/operator_api/delete_tenant_responses.go deleted file mode 100644 index 6ca1afe42..000000000 --- a/operatorapi/operations/operator_api/delete_tenant_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// DeleteTenantNoContentCode is the HTTP code returned for type DeleteTenantNoContent -const DeleteTenantNoContentCode int = 204 - -/* -DeleteTenantNoContent A successful response. - -swagger:response deleteTenantNoContent -*/ -type DeleteTenantNoContent struct { -} - -// NewDeleteTenantNoContent creates DeleteTenantNoContent with default headers values -func NewDeleteTenantNoContent() *DeleteTenantNoContent { - - return &DeleteTenantNoContent{} -} - -// WriteResponse to the client -func (o *DeleteTenantNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -DeleteTenantDefault Generic error response. - -swagger:response deleteTenantDefault -*/ -type DeleteTenantDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTenantDefault creates DeleteTenantDefault with default headers values -func NewDeleteTenantDefault(code int) *DeleteTenantDefault { - if code <= 0 { - code = 500 - } - - return &DeleteTenantDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete tenant default response -func (o *DeleteTenantDefault) WithStatusCode(code int) *DeleteTenantDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete tenant default response -func (o *DeleteTenantDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the delete tenant default response -func (o *DeleteTenantDefault) WithPayload(payload *models.Error) *DeleteTenantDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete tenant default response -func (o *DeleteTenantDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTenantDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/delete_tenant_urlbuilder.go b/operatorapi/operations/operator_api/delete_tenant_urlbuilder.go deleted file mode 100644 index e216c3584..000000000 --- a/operatorapi/operations/operator_api/delete_tenant_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// DeleteTenantURL generates an URL for the delete tenant operation -type DeleteTenantURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTenantURL) WithBasePath(bp string) *DeleteTenantURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTenantURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteTenantURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on DeleteTenantURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on DeleteTenantURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteTenantURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteTenantURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteTenantURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteTenantURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteTenantURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteTenantURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/describe_pod.go b/operatorapi/operations/operator_api/describe_pod.go deleted file mode 100644 index a1d0cc67e..000000000 --- a/operatorapi/operations/operator_api/describe_pod.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// DescribePodHandlerFunc turns a function with the right signature into a describe pod handler -type DescribePodHandlerFunc func(DescribePodParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DescribePodHandlerFunc) Handle(params DescribePodParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DescribePodHandler interface for that can handle valid describe pod params -type DescribePodHandler interface { - Handle(DescribePodParams, *models.Principal) middleware.Responder -} - -// NewDescribePod creates a new http.Handler for the describe pod operation -func NewDescribePod(ctx *middleware.Context, handler DescribePodHandler) *DescribePod { - return &DescribePod{Context: ctx, Handler: handler} -} - -/* - DescribePod swagger:route GET /namespaces/{namespace}/tenants/{tenant}/pods/{podName}/describe OperatorAPI describePod - -Describe Pod -*/ -type DescribePod struct { - Context *middleware.Context - Handler DescribePodHandler -} - -func (o *DescribePod) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDescribePodParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/describe_pod_parameters.go b/operatorapi/operations/operator_api/describe_pod_parameters.go deleted file mode 100644 index c76c4b1e2..000000000 --- a/operatorapi/operations/operator_api/describe_pod_parameters.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewDescribePodParams creates a new DescribePodParams object -// -// There are no default values defined in the spec. -func NewDescribePodParams() DescribePodParams { - - return DescribePodParams{} -} - -// DescribePodParams contains all the bound params for the describe pod operation -// typically these are obtained from a http.Request -// -// swagger:parameters DescribePod -type DescribePodParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - PodName string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDescribePodParams() beforehand. -func (o *DescribePodParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rPodName, rhkPodName, _ := route.Params.GetOK("podName") - if err := o.bindPodName(rPodName, rhkPodName, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *DescribePodParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindPodName binds and validates parameter PodName from path. -func (o *DescribePodParams) bindPodName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.PodName = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *DescribePodParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/describe_pod_responses.go b/operatorapi/operations/operator_api/describe_pod_responses.go deleted file mode 100644 index 575f60ac5..000000000 --- a/operatorapi/operations/operator_api/describe_pod_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// DescribePodOKCode is the HTTP code returned for type DescribePodOK -const DescribePodOKCode int = 200 - -/* -DescribePodOK A successful response. - -swagger:response describePodOK -*/ -type DescribePodOK struct { - - /* - In: Body - */ - Payload *models.DescribePodWrapper `json:"body,omitempty"` -} - -// NewDescribePodOK creates DescribePodOK with default headers values -func NewDescribePodOK() *DescribePodOK { - - return &DescribePodOK{} -} - -// WithPayload adds the payload to the describe pod o k response -func (o *DescribePodOK) WithPayload(payload *models.DescribePodWrapper) *DescribePodOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the describe pod o k response -func (o *DescribePodOK) SetPayload(payload *models.DescribePodWrapper) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DescribePodOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DescribePodDefault Generic error response. - -swagger:response describePodDefault -*/ -type DescribePodDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDescribePodDefault creates DescribePodDefault with default headers values -func NewDescribePodDefault(code int) *DescribePodDefault { - if code <= 0 { - code = 500 - } - - return &DescribePodDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the describe pod default response -func (o *DescribePodDefault) WithStatusCode(code int) *DescribePodDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the describe pod default response -func (o *DescribePodDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the describe pod default response -func (o *DescribePodDefault) WithPayload(payload *models.Error) *DescribePodDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the describe pod default response -func (o *DescribePodDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DescribePodDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/describe_pod_urlbuilder.go b/operatorapi/operations/operator_api/describe_pod_urlbuilder.go deleted file mode 100644 index 6b07e8dba..000000000 --- a/operatorapi/operations/operator_api/describe_pod_urlbuilder.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// DescribePodURL generates an URL for the describe pod operation -type DescribePodURL struct { - Namespace string - PodName string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DescribePodURL) WithBasePath(bp string) *DescribePodURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DescribePodURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DescribePodURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/pods/{podName}/describe" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on DescribePodURL") - } - - podName := o.PodName - if podName != "" { - _path = strings.Replace(_path, "{podName}", podName, -1) - } else { - return nil, errors.New("podName is required on DescribePodURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on DescribePodURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DescribePodURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DescribePodURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DescribePodURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DescribePodURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DescribePodURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DescribePodURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/direct_p_v_format_drive.go b/operatorapi/operations/operator_api/direct_p_v_format_drive.go deleted file mode 100644 index 8eccf6942..000000000 --- a/operatorapi/operations/operator_api/direct_p_v_format_drive.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// DirectPVFormatDriveHandlerFunc turns a function with the right signature into a direct p v format drive handler -type DirectPVFormatDriveHandlerFunc func(DirectPVFormatDriveParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DirectPVFormatDriveHandlerFunc) Handle(params DirectPVFormatDriveParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DirectPVFormatDriveHandler interface for that can handle valid direct p v format drive params -type DirectPVFormatDriveHandler interface { - Handle(DirectPVFormatDriveParams, *models.Principal) middleware.Responder -} - -// NewDirectPVFormatDrive creates a new http.Handler for the direct p v format drive operation -func NewDirectPVFormatDrive(ctx *middleware.Context, handler DirectPVFormatDriveHandler) *DirectPVFormatDrive { - return &DirectPVFormatDrive{Context: ctx, Handler: handler} -} - -/* - DirectPVFormatDrive swagger:route POST /directpv/drives/format OperatorAPI directPVFormatDrive - -Format directpv drives from a list -*/ -type DirectPVFormatDrive struct { - Context *middleware.Context - Handler DirectPVFormatDriveHandler -} - -func (o *DirectPVFormatDrive) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDirectPVFormatDriveParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/direct_p_v_format_drive_parameters.go b/operatorapi/operations/operator_api/direct_p_v_format_drive_parameters.go deleted file mode 100644 index c2327ee7d..000000000 --- a/operatorapi/operations/operator_api/direct_p_v_format_drive_parameters.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewDirectPVFormatDriveParams creates a new DirectPVFormatDriveParams object -// -// There are no default values defined in the spec. -func NewDirectPVFormatDriveParams() DirectPVFormatDriveParams { - - return DirectPVFormatDriveParams{} -} - -// DirectPVFormatDriveParams contains all the bound params for the direct p v format drive operation -// typically these are obtained from a http.Request -// -// swagger:parameters DirectPVFormatDrive -type DirectPVFormatDriveParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.FormatConfiguration -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDirectPVFormatDriveParams() beforehand. -func (o *DirectPVFormatDriveParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.FormatConfiguration - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/operator_api/direct_p_v_format_drive_responses.go b/operatorapi/operations/operator_api/direct_p_v_format_drive_responses.go deleted file mode 100644 index 9a9176748..000000000 --- a/operatorapi/operations/operator_api/direct_p_v_format_drive_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// DirectPVFormatDriveOKCode is the HTTP code returned for type DirectPVFormatDriveOK -const DirectPVFormatDriveOKCode int = 200 - -/* -DirectPVFormatDriveOK A successful response. - -swagger:response directPVFormatDriveOK -*/ -type DirectPVFormatDriveOK struct { - - /* - In: Body - */ - Payload *models.FormatDirectPVDrivesResponse `json:"body,omitempty"` -} - -// NewDirectPVFormatDriveOK creates DirectPVFormatDriveOK with default headers values -func NewDirectPVFormatDriveOK() *DirectPVFormatDriveOK { - - return &DirectPVFormatDriveOK{} -} - -// WithPayload adds the payload to the direct p v format drive o k response -func (o *DirectPVFormatDriveOK) WithPayload(payload *models.FormatDirectPVDrivesResponse) *DirectPVFormatDriveOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the direct p v format drive o k response -func (o *DirectPVFormatDriveOK) SetPayload(payload *models.FormatDirectPVDrivesResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DirectPVFormatDriveOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DirectPVFormatDriveDefault Generic error response. - -swagger:response directPVFormatDriveDefault -*/ -type DirectPVFormatDriveDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDirectPVFormatDriveDefault creates DirectPVFormatDriveDefault with default headers values -func NewDirectPVFormatDriveDefault(code int) *DirectPVFormatDriveDefault { - if code <= 0 { - code = 500 - } - - return &DirectPVFormatDriveDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the direct p v format drive default response -func (o *DirectPVFormatDriveDefault) WithStatusCode(code int) *DirectPVFormatDriveDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the direct p v format drive default response -func (o *DirectPVFormatDriveDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the direct p v format drive default response -func (o *DirectPVFormatDriveDefault) WithPayload(payload *models.Error) *DirectPVFormatDriveDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the direct p v format drive default response -func (o *DirectPVFormatDriveDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DirectPVFormatDriveDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/direct_p_v_format_drive_urlbuilder.go b/operatorapi/operations/operator_api/direct_p_v_format_drive_urlbuilder.go deleted file mode 100644 index 85f22c538..000000000 --- a/operatorapi/operations/operator_api/direct_p_v_format_drive_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// DirectPVFormatDriveURL generates an URL for the direct p v format drive operation -type DirectPVFormatDriveURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DirectPVFormatDriveURL) WithBasePath(bp string) *DirectPVFormatDriveURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DirectPVFormatDriveURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DirectPVFormatDriveURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/directpv/drives/format" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DirectPVFormatDriveURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DirectPVFormatDriveURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DirectPVFormatDriveURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DirectPVFormatDriveURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DirectPVFormatDriveURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DirectPVFormatDriveURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/disable_tenant_logging.go b/operatorapi/operations/operator_api/disable_tenant_logging.go deleted file mode 100644 index 4a6ef5f35..000000000 --- a/operatorapi/operations/operator_api/disable_tenant_logging.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// DisableTenantLoggingHandlerFunc turns a function with the right signature into a disable tenant logging handler -type DisableTenantLoggingHandlerFunc func(DisableTenantLoggingParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DisableTenantLoggingHandlerFunc) Handle(params DisableTenantLoggingParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DisableTenantLoggingHandler interface for that can handle valid disable tenant logging params -type DisableTenantLoggingHandler interface { - Handle(DisableTenantLoggingParams, *models.Principal) middleware.Responder -} - -// NewDisableTenantLogging creates a new http.Handler for the disable tenant logging operation -func NewDisableTenantLogging(ctx *middleware.Context, handler DisableTenantLoggingHandler) *DisableTenantLogging { - return &DisableTenantLogging{Context: ctx, Handler: handler} -} - -/* - DisableTenantLogging swagger:route POST /namespaces/{namespace}/tenants/{tenant}/disable-logging OperatorAPI disableTenantLogging - -Disable Tenant Logging -*/ -type DisableTenantLogging struct { - Context *middleware.Context - Handler DisableTenantLoggingHandler -} - -func (o *DisableTenantLogging) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDisableTenantLoggingParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/disable_tenant_logging_parameters.go b/operatorapi/operations/operator_api/disable_tenant_logging_parameters.go deleted file mode 100644 index fee9edf4a..000000000 --- a/operatorapi/operations/operator_api/disable_tenant_logging_parameters.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewDisableTenantLoggingParams creates a new DisableTenantLoggingParams object -// -// There are no default values defined in the spec. -func NewDisableTenantLoggingParams() DisableTenantLoggingParams { - - return DisableTenantLoggingParams{} -} - -// DisableTenantLoggingParams contains all the bound params for the disable tenant logging operation -// typically these are obtained from a http.Request -// -// swagger:parameters DisableTenantLogging -type DisableTenantLoggingParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDisableTenantLoggingParams() beforehand. -func (o *DisableTenantLoggingParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *DisableTenantLoggingParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *DisableTenantLoggingParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/disable_tenant_logging_responses.go b/operatorapi/operations/operator_api/disable_tenant_logging_responses.go deleted file mode 100644 index 0f177bb97..000000000 --- a/operatorapi/operations/operator_api/disable_tenant_logging_responses.go +++ /dev/null @@ -1,133 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// DisableTenantLoggingOKCode is the HTTP code returned for type DisableTenantLoggingOK -const DisableTenantLoggingOKCode int = 200 - -/* -DisableTenantLoggingOK A successful response. - -swagger:response disableTenantLoggingOK -*/ -type DisableTenantLoggingOK struct { - - /* - In: Body - */ - Payload bool `json:"body,omitempty"` -} - -// NewDisableTenantLoggingOK creates DisableTenantLoggingOK with default headers values -func NewDisableTenantLoggingOK() *DisableTenantLoggingOK { - - return &DisableTenantLoggingOK{} -} - -// WithPayload adds the payload to the disable tenant logging o k response -func (o *DisableTenantLoggingOK) WithPayload(payload bool) *DisableTenantLoggingOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the disable tenant logging o k response -func (o *DisableTenantLoggingOK) SetPayload(payload bool) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DisableTenantLoggingOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -DisableTenantLoggingDefault Generic error response. - -swagger:response disableTenantLoggingDefault -*/ -type DisableTenantLoggingDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDisableTenantLoggingDefault creates DisableTenantLoggingDefault with default headers values -func NewDisableTenantLoggingDefault(code int) *DisableTenantLoggingDefault { - if code <= 0 { - code = 500 - } - - return &DisableTenantLoggingDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the disable tenant logging default response -func (o *DisableTenantLoggingDefault) WithStatusCode(code int) *DisableTenantLoggingDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the disable tenant logging default response -func (o *DisableTenantLoggingDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the disable tenant logging default response -func (o *DisableTenantLoggingDefault) WithPayload(payload *models.Error) *DisableTenantLoggingDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the disable tenant logging default response -func (o *DisableTenantLoggingDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DisableTenantLoggingDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/disable_tenant_logging_urlbuilder.go b/operatorapi/operations/operator_api/disable_tenant_logging_urlbuilder.go deleted file mode 100644 index 1f6da6256..000000000 --- a/operatorapi/operations/operator_api/disable_tenant_logging_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// DisableTenantLoggingURL generates an URL for the disable tenant logging operation -type DisableTenantLoggingURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DisableTenantLoggingURL) WithBasePath(bp string) *DisableTenantLoggingURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DisableTenantLoggingURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DisableTenantLoggingURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/disable-logging" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on DisableTenantLoggingURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on DisableTenantLoggingURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DisableTenantLoggingURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DisableTenantLoggingURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DisableTenantLoggingURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DisableTenantLoggingURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DisableTenantLoggingURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DisableTenantLoggingURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/enable_tenant_logging.go b/operatorapi/operations/operator_api/enable_tenant_logging.go deleted file mode 100644 index e12583b9e..000000000 --- a/operatorapi/operations/operator_api/enable_tenant_logging.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// EnableTenantLoggingHandlerFunc turns a function with the right signature into a enable tenant logging handler -type EnableTenantLoggingHandlerFunc func(EnableTenantLoggingParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn EnableTenantLoggingHandlerFunc) Handle(params EnableTenantLoggingParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// EnableTenantLoggingHandler interface for that can handle valid enable tenant logging params -type EnableTenantLoggingHandler interface { - Handle(EnableTenantLoggingParams, *models.Principal) middleware.Responder -} - -// NewEnableTenantLogging creates a new http.Handler for the enable tenant logging operation -func NewEnableTenantLogging(ctx *middleware.Context, handler EnableTenantLoggingHandler) *EnableTenantLogging { - return &EnableTenantLogging{Context: ctx, Handler: handler} -} - -/* - EnableTenantLogging swagger:route POST /namespaces/{namespace}/tenants/{tenant}/enable-logging OperatorAPI enableTenantLogging - -Enable Tenant Logging -*/ -type EnableTenantLogging struct { - Context *middleware.Context - Handler EnableTenantLoggingHandler -} - -func (o *EnableTenantLogging) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewEnableTenantLoggingParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/enable_tenant_logging_parameters.go b/operatorapi/operations/operator_api/enable_tenant_logging_parameters.go deleted file mode 100644 index 5e484e09e..000000000 --- a/operatorapi/operations/operator_api/enable_tenant_logging_parameters.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewEnableTenantLoggingParams creates a new EnableTenantLoggingParams object -// -// There are no default values defined in the spec. -func NewEnableTenantLoggingParams() EnableTenantLoggingParams { - - return EnableTenantLoggingParams{} -} - -// EnableTenantLoggingParams contains all the bound params for the enable tenant logging operation -// typically these are obtained from a http.Request -// -// swagger:parameters EnableTenantLogging -type EnableTenantLoggingParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewEnableTenantLoggingParams() beforehand. -func (o *EnableTenantLoggingParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *EnableTenantLoggingParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *EnableTenantLoggingParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/enable_tenant_logging_responses.go b/operatorapi/operations/operator_api/enable_tenant_logging_responses.go deleted file mode 100644 index 907d66fcd..000000000 --- a/operatorapi/operations/operator_api/enable_tenant_logging_responses.go +++ /dev/null @@ -1,133 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// EnableTenantLoggingOKCode is the HTTP code returned for type EnableTenantLoggingOK -const EnableTenantLoggingOKCode int = 200 - -/* -EnableTenantLoggingOK A successful response. - -swagger:response enableTenantLoggingOK -*/ -type EnableTenantLoggingOK struct { - - /* - In: Body - */ - Payload bool `json:"body,omitempty"` -} - -// NewEnableTenantLoggingOK creates EnableTenantLoggingOK with default headers values -func NewEnableTenantLoggingOK() *EnableTenantLoggingOK { - - return &EnableTenantLoggingOK{} -} - -// WithPayload adds the payload to the enable tenant logging o k response -func (o *EnableTenantLoggingOK) WithPayload(payload bool) *EnableTenantLoggingOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the enable tenant logging o k response -func (o *EnableTenantLoggingOK) SetPayload(payload bool) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EnableTenantLoggingOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -EnableTenantLoggingDefault Generic error response. - -swagger:response enableTenantLoggingDefault -*/ -type EnableTenantLoggingDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewEnableTenantLoggingDefault creates EnableTenantLoggingDefault with default headers values -func NewEnableTenantLoggingDefault(code int) *EnableTenantLoggingDefault { - if code <= 0 { - code = 500 - } - - return &EnableTenantLoggingDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the enable tenant logging default response -func (o *EnableTenantLoggingDefault) WithStatusCode(code int) *EnableTenantLoggingDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the enable tenant logging default response -func (o *EnableTenantLoggingDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the enable tenant logging default response -func (o *EnableTenantLoggingDefault) WithPayload(payload *models.Error) *EnableTenantLoggingDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the enable tenant logging default response -func (o *EnableTenantLoggingDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EnableTenantLoggingDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/enable_tenant_logging_urlbuilder.go b/operatorapi/operations/operator_api/enable_tenant_logging_urlbuilder.go deleted file mode 100644 index 31dfee90a..000000000 --- a/operatorapi/operations/operator_api/enable_tenant_logging_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// EnableTenantLoggingURL generates an URL for the enable tenant logging operation -type EnableTenantLoggingURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *EnableTenantLoggingURL) WithBasePath(bp string) *EnableTenantLoggingURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *EnableTenantLoggingURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *EnableTenantLoggingURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/enable-logging" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on EnableTenantLoggingURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on EnableTenantLoggingURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *EnableTenantLoggingURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *EnableTenantLoggingURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *EnableTenantLoggingURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on EnableTenantLoggingURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on EnableTenantLoggingURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *EnableTenantLoggingURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/get_allocatable_resources.go b/operatorapi/operations/operator_api/get_allocatable_resources.go deleted file mode 100644 index 733cb08ea..000000000 --- a/operatorapi/operations/operator_api/get_allocatable_resources.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// GetAllocatableResourcesHandlerFunc turns a function with the right signature into a get allocatable resources handler -type GetAllocatableResourcesHandlerFunc func(GetAllocatableResourcesParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllocatableResourcesHandlerFunc) Handle(params GetAllocatableResourcesParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetAllocatableResourcesHandler interface for that can handle valid get allocatable resources params -type GetAllocatableResourcesHandler interface { - Handle(GetAllocatableResourcesParams, *models.Principal) middleware.Responder -} - -// NewGetAllocatableResources creates a new http.Handler for the get allocatable resources operation -func NewGetAllocatableResources(ctx *middleware.Context, handler GetAllocatableResourcesHandler) *GetAllocatableResources { - return &GetAllocatableResources{Context: ctx, Handler: handler} -} - -/* - GetAllocatableResources swagger:route GET /cluster/allocatable-resources OperatorAPI getAllocatableResources - -Get allocatable cpu and memory for given number of nodes -*/ -type GetAllocatableResources struct { - Context *middleware.Context - Handler GetAllocatableResourcesHandler -} - -func (o *GetAllocatableResources) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllocatableResourcesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/get_allocatable_resources_parameters.go b/operatorapi/operations/operator_api/get_allocatable_resources_parameters.go deleted file mode 100644 index a15d00439..000000000 --- a/operatorapi/operations/operator_api/get_allocatable_resources_parameters.go +++ /dev/null @@ -1,120 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewGetAllocatableResourcesParams creates a new GetAllocatableResourcesParams object -// -// There are no default values defined in the spec. -func NewGetAllocatableResourcesParams() GetAllocatableResourcesParams { - - return GetAllocatableResourcesParams{} -} - -// GetAllocatableResourcesParams contains all the bound params for the get allocatable resources operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetAllocatableResources -type GetAllocatableResourcesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - Minimum: 1 - In: query - */ - NumNodes int32 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllocatableResourcesParams() beforehand. -func (o *GetAllocatableResourcesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qNumNodes, qhkNumNodes, _ := qs.GetOK("num_nodes") - if err := o.bindNumNodes(qNumNodes, qhkNumNodes, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNumNodes binds and validates parameter NumNodes from query. -func (o *GetAllocatableResourcesParams) bindNumNodes(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("num_nodes", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("num_nodes", "query", raw); err != nil { - return err - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("num_nodes", "query", "int32", raw) - } - o.NumNodes = value - - if err := o.validateNumNodes(formats); err != nil { - return err - } - - return nil -} - -// validateNumNodes carries on validations for parameter NumNodes -func (o *GetAllocatableResourcesParams) validateNumNodes(formats strfmt.Registry) error { - - if err := validate.MinimumInt("num_nodes", "query", int64(o.NumNodes), 1, false); err != nil { - return err - } - - return nil -} diff --git a/operatorapi/operations/operator_api/get_allocatable_resources_responses.go b/operatorapi/operations/operator_api/get_allocatable_resources_responses.go deleted file mode 100644 index c4495130f..000000000 --- a/operatorapi/operations/operator_api/get_allocatable_resources_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// GetAllocatableResourcesOKCode is the HTTP code returned for type GetAllocatableResourcesOK -const GetAllocatableResourcesOKCode int = 200 - -/* -GetAllocatableResourcesOK A successful response. - -swagger:response getAllocatableResourcesOK -*/ -type GetAllocatableResourcesOK struct { - - /* - In: Body - */ - Payload *models.AllocatableResourcesResponse `json:"body,omitempty"` -} - -// NewGetAllocatableResourcesOK creates GetAllocatableResourcesOK with default headers values -func NewGetAllocatableResourcesOK() *GetAllocatableResourcesOK { - - return &GetAllocatableResourcesOK{} -} - -// WithPayload adds the payload to the get allocatable resources o k response -func (o *GetAllocatableResourcesOK) WithPayload(payload *models.AllocatableResourcesResponse) *GetAllocatableResourcesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get allocatable resources o k response -func (o *GetAllocatableResourcesOK) SetPayload(payload *models.AllocatableResourcesResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllocatableResourcesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetAllocatableResourcesDefault Generic error response. - -swagger:response getAllocatableResourcesDefault -*/ -type GetAllocatableResourcesDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllocatableResourcesDefault creates GetAllocatableResourcesDefault with default headers values -func NewGetAllocatableResourcesDefault(code int) *GetAllocatableResourcesDefault { - if code <= 0 { - code = 500 - } - - return &GetAllocatableResourcesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get allocatable resources default response -func (o *GetAllocatableResourcesDefault) WithStatusCode(code int) *GetAllocatableResourcesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get allocatable resources default response -func (o *GetAllocatableResourcesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get allocatable resources default response -func (o *GetAllocatableResourcesDefault) WithPayload(payload *models.Error) *GetAllocatableResourcesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get allocatable resources default response -func (o *GetAllocatableResourcesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllocatableResourcesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/get_allocatable_resources_urlbuilder.go b/operatorapi/operations/operator_api/get_allocatable_resources_urlbuilder.go deleted file mode 100644 index 4987eaa07..000000000 --- a/operatorapi/operations/operator_api/get_allocatable_resources_urlbuilder.go +++ /dev/null @@ -1,119 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// GetAllocatableResourcesURL generates an URL for the get allocatable resources operation -type GetAllocatableResourcesURL struct { - NumNodes int32 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllocatableResourcesURL) WithBasePath(bp string) *GetAllocatableResourcesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllocatableResourcesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllocatableResourcesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/cluster/allocatable-resources" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - numNodesQ := swag.FormatInt32(o.NumNodes) - if numNodesQ != "" { - qs.Set("num_nodes", numNodesQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllocatableResourcesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllocatableResourcesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllocatableResourcesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllocatableResourcesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllocatableResourcesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllocatableResourcesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/get_direct_p_v_drive_list.go b/operatorapi/operations/operator_api/get_direct_p_v_drive_list.go deleted file mode 100644 index b20a668dc..000000000 --- a/operatorapi/operations/operator_api/get_direct_p_v_drive_list.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// GetDirectPVDriveListHandlerFunc turns a function with the right signature into a get direct p v drive list handler -type GetDirectPVDriveListHandlerFunc func(GetDirectPVDriveListParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetDirectPVDriveListHandlerFunc) Handle(params GetDirectPVDriveListParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetDirectPVDriveListHandler interface for that can handle valid get direct p v drive list params -type GetDirectPVDriveListHandler interface { - Handle(GetDirectPVDriveListParams, *models.Principal) middleware.Responder -} - -// NewGetDirectPVDriveList creates a new http.Handler for the get direct p v drive list operation -func NewGetDirectPVDriveList(ctx *middleware.Context, handler GetDirectPVDriveListHandler) *GetDirectPVDriveList { - return &GetDirectPVDriveList{Context: ctx, Handler: handler} -} - -/* - GetDirectPVDriveList swagger:route GET /directpv/drives OperatorAPI getDirectPVDriveList - -Get directpv drives list -*/ -type GetDirectPVDriveList struct { - Context *middleware.Context - Handler GetDirectPVDriveListHandler -} - -func (o *GetDirectPVDriveList) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetDirectPVDriveListParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/get_direct_p_v_drive_list_parameters.go b/operatorapi/operations/operator_api/get_direct_p_v_drive_list_parameters.go deleted file mode 100644 index bbdcfc002..000000000 --- a/operatorapi/operations/operator_api/get_direct_p_v_drive_list_parameters.go +++ /dev/null @@ -1,121 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetDirectPVDriveListParams creates a new GetDirectPVDriveListParams object -// -// There are no default values defined in the spec. -func NewGetDirectPVDriveListParams() GetDirectPVDriveListParams { - - return GetDirectPVDriveListParams{} -} - -// GetDirectPVDriveListParams contains all the bound params for the get direct p v drive list operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetDirectPVDriveList -type GetDirectPVDriveListParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - In: query - */ - Drives *string - /* - In: query - */ - Nodes *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetDirectPVDriveListParams() beforehand. -func (o *GetDirectPVDriveListParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qDrives, qhkDrives, _ := qs.GetOK("drives") - if err := o.bindDrives(qDrives, qhkDrives, route.Formats); err != nil { - res = append(res, err) - } - - qNodes, qhkNodes, _ := qs.GetOK("nodes") - if err := o.bindNodes(qNodes, qhkNodes, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindDrives binds and validates parameter Drives from query. -func (o *GetDirectPVDriveListParams) bindDrives(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.Drives = &raw - - return nil -} - -// bindNodes binds and validates parameter Nodes from query. -func (o *GetDirectPVDriveListParams) bindNodes(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.Nodes = &raw - - return nil -} diff --git a/operatorapi/operations/operator_api/get_direct_p_v_drive_list_responses.go b/operatorapi/operations/operator_api/get_direct_p_v_drive_list_responses.go deleted file mode 100644 index dda89d687..000000000 --- a/operatorapi/operations/operator_api/get_direct_p_v_drive_list_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// GetDirectPVDriveListOKCode is the HTTP code returned for type GetDirectPVDriveListOK -const GetDirectPVDriveListOKCode int = 200 - -/* -GetDirectPVDriveListOK A successful response. - -swagger:response getDirectPVDriveListOK -*/ -type GetDirectPVDriveListOK struct { - - /* - In: Body - */ - Payload *models.GetDirectPVDriveListResponse `json:"body,omitempty"` -} - -// NewGetDirectPVDriveListOK creates GetDirectPVDriveListOK with default headers values -func NewGetDirectPVDriveListOK() *GetDirectPVDriveListOK { - - return &GetDirectPVDriveListOK{} -} - -// WithPayload adds the payload to the get direct p v drive list o k response -func (o *GetDirectPVDriveListOK) WithPayload(payload *models.GetDirectPVDriveListResponse) *GetDirectPVDriveListOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get direct p v drive list o k response -func (o *GetDirectPVDriveListOK) SetPayload(payload *models.GetDirectPVDriveListResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDirectPVDriveListOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetDirectPVDriveListDefault Generic error response. - -swagger:response getDirectPVDriveListDefault -*/ -type GetDirectPVDriveListDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetDirectPVDriveListDefault creates GetDirectPVDriveListDefault with default headers values -func NewGetDirectPVDriveListDefault(code int) *GetDirectPVDriveListDefault { - if code <= 0 { - code = 500 - } - - return &GetDirectPVDriveListDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get direct p v drive list default response -func (o *GetDirectPVDriveListDefault) WithStatusCode(code int) *GetDirectPVDriveListDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get direct p v drive list default response -func (o *GetDirectPVDriveListDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get direct p v drive list default response -func (o *GetDirectPVDriveListDefault) WithPayload(payload *models.Error) *GetDirectPVDriveListDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get direct p v drive list default response -func (o *GetDirectPVDriveListDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDirectPVDriveListDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/get_direct_p_v_drive_list_urlbuilder.go b/operatorapi/operations/operator_api/get_direct_p_v_drive_list_urlbuilder.go deleted file mode 100644 index 201f335fe..000000000 --- a/operatorapi/operations/operator_api/get_direct_p_v_drive_list_urlbuilder.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetDirectPVDriveListURL generates an URL for the get direct p v drive list operation -type GetDirectPVDriveListURL struct { - Drives *string - Nodes *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetDirectPVDriveListURL) WithBasePath(bp string) *GetDirectPVDriveListURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetDirectPVDriveListURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetDirectPVDriveListURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/directpv/drives" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var drivesQ string - if o.Drives != nil { - drivesQ = *o.Drives - } - if drivesQ != "" { - qs.Set("drives", drivesQ) - } - - var nodesQ string - if o.Nodes != nil { - nodesQ = *o.Nodes - } - if nodesQ != "" { - qs.Set("nodes", nodesQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetDirectPVDriveListURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetDirectPVDriveListURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetDirectPVDriveListURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetDirectPVDriveListURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetDirectPVDriveListURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetDirectPVDriveListURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/get_direct_p_v_volume_list.go b/operatorapi/operations/operator_api/get_direct_p_v_volume_list.go deleted file mode 100644 index 28cc1d9de..000000000 --- a/operatorapi/operations/operator_api/get_direct_p_v_volume_list.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// GetDirectPVVolumeListHandlerFunc turns a function with the right signature into a get direct p v volume list handler -type GetDirectPVVolumeListHandlerFunc func(GetDirectPVVolumeListParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetDirectPVVolumeListHandlerFunc) Handle(params GetDirectPVVolumeListParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetDirectPVVolumeListHandler interface for that can handle valid get direct p v volume list params -type GetDirectPVVolumeListHandler interface { - Handle(GetDirectPVVolumeListParams, *models.Principal) middleware.Responder -} - -// NewGetDirectPVVolumeList creates a new http.Handler for the get direct p v volume list operation -func NewGetDirectPVVolumeList(ctx *middleware.Context, handler GetDirectPVVolumeListHandler) *GetDirectPVVolumeList { - return &GetDirectPVVolumeList{Context: ctx, Handler: handler} -} - -/* - GetDirectPVVolumeList swagger:route GET /directpv/volumes OperatorAPI getDirectPVVolumeList - -Get directpv volumes list -*/ -type GetDirectPVVolumeList struct { - Context *middleware.Context - Handler GetDirectPVVolumeListHandler -} - -func (o *GetDirectPVVolumeList) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetDirectPVVolumeListParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/get_direct_p_v_volume_list_parameters.go b/operatorapi/operations/operator_api/get_direct_p_v_volume_list_parameters.go deleted file mode 100644 index 068f26699..000000000 --- a/operatorapi/operations/operator_api/get_direct_p_v_volume_list_parameters.go +++ /dev/null @@ -1,121 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetDirectPVVolumeListParams creates a new GetDirectPVVolumeListParams object -// -// There are no default values defined in the spec. -func NewGetDirectPVVolumeListParams() GetDirectPVVolumeListParams { - - return GetDirectPVVolumeListParams{} -} - -// GetDirectPVVolumeListParams contains all the bound params for the get direct p v volume list operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetDirectPVVolumeList -type GetDirectPVVolumeListParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - In: query - */ - Drives *string - /* - In: query - */ - Nodes *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetDirectPVVolumeListParams() beforehand. -func (o *GetDirectPVVolumeListParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qDrives, qhkDrives, _ := qs.GetOK("drives") - if err := o.bindDrives(qDrives, qhkDrives, route.Formats); err != nil { - res = append(res, err) - } - - qNodes, qhkNodes, _ := qs.GetOK("nodes") - if err := o.bindNodes(qNodes, qhkNodes, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindDrives binds and validates parameter Drives from query. -func (o *GetDirectPVVolumeListParams) bindDrives(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.Drives = &raw - - return nil -} - -// bindNodes binds and validates parameter Nodes from query. -func (o *GetDirectPVVolumeListParams) bindNodes(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.Nodes = &raw - - return nil -} diff --git a/operatorapi/operations/operator_api/get_direct_p_v_volume_list_responses.go b/operatorapi/operations/operator_api/get_direct_p_v_volume_list_responses.go deleted file mode 100644 index 2caa5aeea..000000000 --- a/operatorapi/operations/operator_api/get_direct_p_v_volume_list_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// GetDirectPVVolumeListOKCode is the HTTP code returned for type GetDirectPVVolumeListOK -const GetDirectPVVolumeListOKCode int = 200 - -/* -GetDirectPVVolumeListOK A successful response. - -swagger:response getDirectPVVolumeListOK -*/ -type GetDirectPVVolumeListOK struct { - - /* - In: Body - */ - Payload *models.GetDirectPVVolumeListResponse `json:"body,omitempty"` -} - -// NewGetDirectPVVolumeListOK creates GetDirectPVVolumeListOK with default headers values -func NewGetDirectPVVolumeListOK() *GetDirectPVVolumeListOK { - - return &GetDirectPVVolumeListOK{} -} - -// WithPayload adds the payload to the get direct p v volume list o k response -func (o *GetDirectPVVolumeListOK) WithPayload(payload *models.GetDirectPVVolumeListResponse) *GetDirectPVVolumeListOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get direct p v volume list o k response -func (o *GetDirectPVVolumeListOK) SetPayload(payload *models.GetDirectPVVolumeListResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDirectPVVolumeListOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetDirectPVVolumeListDefault Generic error response. - -swagger:response getDirectPVVolumeListDefault -*/ -type GetDirectPVVolumeListDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetDirectPVVolumeListDefault creates GetDirectPVVolumeListDefault with default headers values -func NewGetDirectPVVolumeListDefault(code int) *GetDirectPVVolumeListDefault { - if code <= 0 { - code = 500 - } - - return &GetDirectPVVolumeListDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get direct p v volume list default response -func (o *GetDirectPVVolumeListDefault) WithStatusCode(code int) *GetDirectPVVolumeListDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get direct p v volume list default response -func (o *GetDirectPVVolumeListDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get direct p v volume list default response -func (o *GetDirectPVVolumeListDefault) WithPayload(payload *models.Error) *GetDirectPVVolumeListDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get direct p v volume list default response -func (o *GetDirectPVVolumeListDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDirectPVVolumeListDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/get_direct_p_v_volume_list_urlbuilder.go b/operatorapi/operations/operator_api/get_direct_p_v_volume_list_urlbuilder.go deleted file mode 100644 index dd11d28b4..000000000 --- a/operatorapi/operations/operator_api/get_direct_p_v_volume_list_urlbuilder.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetDirectPVVolumeListURL generates an URL for the get direct p v volume list operation -type GetDirectPVVolumeListURL struct { - Drives *string - Nodes *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetDirectPVVolumeListURL) WithBasePath(bp string) *GetDirectPVVolumeListURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetDirectPVVolumeListURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetDirectPVVolumeListURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/directpv/volumes" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var drivesQ string - if o.Drives != nil { - drivesQ = *o.Drives - } - if drivesQ != "" { - qs.Set("drives", drivesQ) - } - - var nodesQ string - if o.Nodes != nil { - nodesQ = *o.Nodes - } - if nodesQ != "" { - qs.Set("nodes", nodesQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetDirectPVVolumeListURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetDirectPVVolumeListURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetDirectPVVolumeListURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetDirectPVVolumeListURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetDirectPVVolumeListURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetDirectPVVolumeListURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/get_m_p_integration.go b/operatorapi/operations/operator_api/get_m_p_integration.go deleted file mode 100644 index 6761441f7..000000000 --- a/operatorapi/operations/operator_api/get_m_p_integration.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "context" - "net/http" - - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/minio/console/models" -) - -// GetMPIntegrationHandlerFunc turns a function with the right signature into a get m p integration handler -type GetMPIntegrationHandlerFunc func(GetMPIntegrationParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetMPIntegrationHandlerFunc) Handle(params GetMPIntegrationParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetMPIntegrationHandler interface for that can handle valid get m p integration params -type GetMPIntegrationHandler interface { - Handle(GetMPIntegrationParams, *models.Principal) middleware.Responder -} - -// NewGetMPIntegration creates a new http.Handler for the get m p integration operation -func NewGetMPIntegration(ctx *middleware.Context, handler GetMPIntegrationHandler) *GetMPIntegration { - return &GetMPIntegration{Context: ctx, Handler: handler} -} - -/* - GetMPIntegration swagger:route GET /mp-integration OperatorAPI getMPIntegration - -Returns email registered for marketplace integration -*/ -type GetMPIntegration struct { - Context *middleware.Context - Handler GetMPIntegrationHandler -} - -func (o *GetMPIntegration) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetMPIntegrationParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} - -// GetMPIntegrationOKBody get m p integration o k body -// -// swagger:model GetMPIntegrationOKBody -type GetMPIntegrationOKBody struct { - - // is email set - IsEmailSet bool `json:"isEmailSet,omitempty"` -} - -// Validate validates this get m p integration o k body -func (o *GetMPIntegrationOKBody) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this get m p integration o k body based on context it is used -func (o *GetMPIntegrationOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *GetMPIntegrationOKBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *GetMPIntegrationOKBody) UnmarshalBinary(b []byte) error { - var res GetMPIntegrationOKBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/operatorapi/operations/operator_api/get_m_p_integration_parameters.go b/operatorapi/operations/operator_api/get_m_p_integration_parameters.go deleted file mode 100644 index dd616cdfc..000000000 --- a/operatorapi/operations/operator_api/get_m_p_integration_parameters.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetMPIntegrationParams creates a new GetMPIntegrationParams object -// -// There are no default values defined in the spec. -func NewGetMPIntegrationParams() GetMPIntegrationParams { - - return GetMPIntegrationParams{} -} - -// GetMPIntegrationParams contains all the bound params for the get m p integration operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetMPIntegration -type GetMPIntegrationParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetMPIntegrationParams() beforehand. -func (o *GetMPIntegrationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/operator_api/get_m_p_integration_responses.go b/operatorapi/operations/operator_api/get_m_p_integration_responses.go deleted file mode 100644 index 62d8a6748..000000000 --- a/operatorapi/operations/operator_api/get_m_p_integration_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// GetMPIntegrationOKCode is the HTTP code returned for type GetMPIntegrationOK -const GetMPIntegrationOKCode int = 200 - -/* -GetMPIntegrationOK A successful response. - -swagger:response getMPIntegrationOK -*/ -type GetMPIntegrationOK struct { - - /* - In: Body - */ - Payload *GetMPIntegrationOKBody `json:"body,omitempty"` -} - -// NewGetMPIntegrationOK creates GetMPIntegrationOK with default headers values -func NewGetMPIntegrationOK() *GetMPIntegrationOK { - - return &GetMPIntegrationOK{} -} - -// WithPayload adds the payload to the get m p integration o k response -func (o *GetMPIntegrationOK) WithPayload(payload *GetMPIntegrationOKBody) *GetMPIntegrationOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get m p integration o k response -func (o *GetMPIntegrationOK) SetPayload(payload *GetMPIntegrationOKBody) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetMPIntegrationOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetMPIntegrationDefault Generic error response. - -swagger:response getMPIntegrationDefault -*/ -type GetMPIntegrationDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetMPIntegrationDefault creates GetMPIntegrationDefault with default headers values -func NewGetMPIntegrationDefault(code int) *GetMPIntegrationDefault { - if code <= 0 { - code = 500 - } - - return &GetMPIntegrationDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get m p integration default response -func (o *GetMPIntegrationDefault) WithStatusCode(code int) *GetMPIntegrationDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get m p integration default response -func (o *GetMPIntegrationDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get m p integration default response -func (o *GetMPIntegrationDefault) WithPayload(payload *models.Error) *GetMPIntegrationDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get m p integration default response -func (o *GetMPIntegrationDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetMPIntegrationDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/get_m_p_integration_urlbuilder.go b/operatorapi/operations/operator_api/get_m_p_integration_urlbuilder.go deleted file mode 100644 index 374bf99d8..000000000 --- a/operatorapi/operations/operator_api/get_m_p_integration_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetMPIntegrationURL generates an URL for the get m p integration operation -type GetMPIntegrationURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetMPIntegrationURL) WithBasePath(bp string) *GetMPIntegrationURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetMPIntegrationURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetMPIntegrationURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/mp-integration" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetMPIntegrationURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetMPIntegrationURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetMPIntegrationURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetMPIntegrationURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetMPIntegrationURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetMPIntegrationURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/get_max_allocatable_mem.go b/operatorapi/operations/operator_api/get_max_allocatable_mem.go deleted file mode 100644 index bc5aac343..000000000 --- a/operatorapi/operations/operator_api/get_max_allocatable_mem.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// GetMaxAllocatableMemHandlerFunc turns a function with the right signature into a get max allocatable mem handler -type GetMaxAllocatableMemHandlerFunc func(GetMaxAllocatableMemParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetMaxAllocatableMemHandlerFunc) Handle(params GetMaxAllocatableMemParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetMaxAllocatableMemHandler interface for that can handle valid get max allocatable mem params -type GetMaxAllocatableMemHandler interface { - Handle(GetMaxAllocatableMemParams, *models.Principal) middleware.Responder -} - -// NewGetMaxAllocatableMem creates a new http.Handler for the get max allocatable mem operation -func NewGetMaxAllocatableMem(ctx *middleware.Context, handler GetMaxAllocatableMemHandler) *GetMaxAllocatableMem { - return &GetMaxAllocatableMem{Context: ctx, Handler: handler} -} - -/* - GetMaxAllocatableMem swagger:route GET /cluster/max-allocatable-memory OperatorAPI getMaxAllocatableMem - -Get maximum allocatable memory for given number of nodes -*/ -type GetMaxAllocatableMem struct { - Context *middleware.Context - Handler GetMaxAllocatableMemHandler -} - -func (o *GetMaxAllocatableMem) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetMaxAllocatableMemParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/get_max_allocatable_mem_parameters.go b/operatorapi/operations/operator_api/get_max_allocatable_mem_parameters.go deleted file mode 100644 index af444c029..000000000 --- a/operatorapi/operations/operator_api/get_max_allocatable_mem_parameters.go +++ /dev/null @@ -1,120 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewGetMaxAllocatableMemParams creates a new GetMaxAllocatableMemParams object -// -// There are no default values defined in the spec. -func NewGetMaxAllocatableMemParams() GetMaxAllocatableMemParams { - - return GetMaxAllocatableMemParams{} -} - -// GetMaxAllocatableMemParams contains all the bound params for the get max allocatable mem operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetMaxAllocatableMem -type GetMaxAllocatableMemParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - Minimum: 1 - In: query - */ - NumNodes int32 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetMaxAllocatableMemParams() beforehand. -func (o *GetMaxAllocatableMemParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qNumNodes, qhkNumNodes, _ := qs.GetOK("num_nodes") - if err := o.bindNumNodes(qNumNodes, qhkNumNodes, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNumNodes binds and validates parameter NumNodes from query. -func (o *GetMaxAllocatableMemParams) bindNumNodes(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("num_nodes", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("num_nodes", "query", raw); err != nil { - return err - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("num_nodes", "query", "int32", raw) - } - o.NumNodes = value - - if err := o.validateNumNodes(formats); err != nil { - return err - } - - return nil -} - -// validateNumNodes carries on validations for parameter NumNodes -func (o *GetMaxAllocatableMemParams) validateNumNodes(formats strfmt.Registry) error { - - if err := validate.MinimumInt("num_nodes", "query", int64(o.NumNodes), 1, false); err != nil { - return err - } - - return nil -} diff --git a/operatorapi/operations/operator_api/get_max_allocatable_mem_responses.go b/operatorapi/operations/operator_api/get_max_allocatable_mem_responses.go deleted file mode 100644 index 7ee3b2dbe..000000000 --- a/operatorapi/operations/operator_api/get_max_allocatable_mem_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// GetMaxAllocatableMemOKCode is the HTTP code returned for type GetMaxAllocatableMemOK -const GetMaxAllocatableMemOKCode int = 200 - -/* -GetMaxAllocatableMemOK A successful response. - -swagger:response getMaxAllocatableMemOK -*/ -type GetMaxAllocatableMemOK struct { - - /* - In: Body - */ - Payload *models.MaxAllocatableMemResponse `json:"body,omitempty"` -} - -// NewGetMaxAllocatableMemOK creates GetMaxAllocatableMemOK with default headers values -func NewGetMaxAllocatableMemOK() *GetMaxAllocatableMemOK { - - return &GetMaxAllocatableMemOK{} -} - -// WithPayload adds the payload to the get max allocatable mem o k response -func (o *GetMaxAllocatableMemOK) WithPayload(payload *models.MaxAllocatableMemResponse) *GetMaxAllocatableMemOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get max allocatable mem o k response -func (o *GetMaxAllocatableMemOK) SetPayload(payload *models.MaxAllocatableMemResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetMaxAllocatableMemOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetMaxAllocatableMemDefault Generic error response. - -swagger:response getMaxAllocatableMemDefault -*/ -type GetMaxAllocatableMemDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetMaxAllocatableMemDefault creates GetMaxAllocatableMemDefault with default headers values -func NewGetMaxAllocatableMemDefault(code int) *GetMaxAllocatableMemDefault { - if code <= 0 { - code = 500 - } - - return &GetMaxAllocatableMemDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get max allocatable mem default response -func (o *GetMaxAllocatableMemDefault) WithStatusCode(code int) *GetMaxAllocatableMemDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get max allocatable mem default response -func (o *GetMaxAllocatableMemDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get max allocatable mem default response -func (o *GetMaxAllocatableMemDefault) WithPayload(payload *models.Error) *GetMaxAllocatableMemDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get max allocatable mem default response -func (o *GetMaxAllocatableMemDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetMaxAllocatableMemDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/get_max_allocatable_mem_urlbuilder.go b/operatorapi/operations/operator_api/get_max_allocatable_mem_urlbuilder.go deleted file mode 100644 index 099e761a2..000000000 --- a/operatorapi/operations/operator_api/get_max_allocatable_mem_urlbuilder.go +++ /dev/null @@ -1,119 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// GetMaxAllocatableMemURL generates an URL for the get max allocatable mem operation -type GetMaxAllocatableMemURL struct { - NumNodes int32 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetMaxAllocatableMemURL) WithBasePath(bp string) *GetMaxAllocatableMemURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetMaxAllocatableMemURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetMaxAllocatableMemURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/cluster/max-allocatable-memory" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - numNodesQ := swag.FormatInt32(o.NumNodes) - if numNodesQ != "" { - qs.Set("num_nodes", numNodesQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetMaxAllocatableMemURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetMaxAllocatableMemURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetMaxAllocatableMemURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetMaxAllocatableMemURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetMaxAllocatableMemURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetMaxAllocatableMemURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/get_p_v_c_describe.go b/operatorapi/operations/operator_api/get_p_v_c_describe.go deleted file mode 100644 index 296a546ae..000000000 --- a/operatorapi/operations/operator_api/get_p_v_c_describe.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// GetPVCDescribeHandlerFunc turns a function with the right signature into a get p v c describe handler -type GetPVCDescribeHandlerFunc func(GetPVCDescribeParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetPVCDescribeHandlerFunc) Handle(params GetPVCDescribeParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetPVCDescribeHandler interface for that can handle valid get p v c describe params -type GetPVCDescribeHandler interface { - Handle(GetPVCDescribeParams, *models.Principal) middleware.Responder -} - -// NewGetPVCDescribe creates a new http.Handler for the get p v c describe operation -func NewGetPVCDescribe(ctx *middleware.Context, handler GetPVCDescribeHandler) *GetPVCDescribe { - return &GetPVCDescribe{Context: ctx, Handler: handler} -} - -/* - GetPVCDescribe swagger:route GET /namespaces/{namespace}/tenants/{tenant}/pvcs/{PVCName}/describe OperatorAPI getPVCDescribe - -Get Describe output for PVC -*/ -type GetPVCDescribe struct { - Context *middleware.Context - Handler GetPVCDescribeHandler -} - -func (o *GetPVCDescribe) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetPVCDescribeParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/get_p_v_c_describe_parameters.go b/operatorapi/operations/operator_api/get_p_v_c_describe_parameters.go deleted file mode 100644 index 1ce439d7b..000000000 --- a/operatorapi/operations/operator_api/get_p_v_c_describe_parameters.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetPVCDescribeParams creates a new GetPVCDescribeParams object -// -// There are no default values defined in the spec. -func NewGetPVCDescribeParams() GetPVCDescribeParams { - - return GetPVCDescribeParams{} -} - -// GetPVCDescribeParams contains all the bound params for the get p v c describe operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetPVCDescribe -type GetPVCDescribeParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - PVCName string - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetPVCDescribeParams() beforehand. -func (o *GetPVCDescribeParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rPVCName, rhkPVCName, _ := route.Params.GetOK("PVCName") - if err := o.bindPVCName(rPVCName, rhkPVCName, route.Formats); err != nil { - res = append(res, err) - } - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindPVCName binds and validates parameter PVCName from path. -func (o *GetPVCDescribeParams) bindPVCName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.PVCName = raw - - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *GetPVCDescribeParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *GetPVCDescribeParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/get_p_v_c_describe_responses.go b/operatorapi/operations/operator_api/get_p_v_c_describe_responses.go deleted file mode 100644 index c0134c889..000000000 --- a/operatorapi/operations/operator_api/get_p_v_c_describe_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// GetPVCDescribeOKCode is the HTTP code returned for type GetPVCDescribeOK -const GetPVCDescribeOKCode int = 200 - -/* -GetPVCDescribeOK A successful response. - -swagger:response getPVCDescribeOK -*/ -type GetPVCDescribeOK struct { - - /* - In: Body - */ - Payload *models.DescribePVCWrapper `json:"body,omitempty"` -} - -// NewGetPVCDescribeOK creates GetPVCDescribeOK with default headers values -func NewGetPVCDescribeOK() *GetPVCDescribeOK { - - return &GetPVCDescribeOK{} -} - -// WithPayload adds the payload to the get p v c describe o k response -func (o *GetPVCDescribeOK) WithPayload(payload *models.DescribePVCWrapper) *GetPVCDescribeOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get p v c describe o k response -func (o *GetPVCDescribeOK) SetPayload(payload *models.DescribePVCWrapper) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetPVCDescribeOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetPVCDescribeDefault Generic error response. - -swagger:response getPVCDescribeDefault -*/ -type GetPVCDescribeDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetPVCDescribeDefault creates GetPVCDescribeDefault with default headers values -func NewGetPVCDescribeDefault(code int) *GetPVCDescribeDefault { - if code <= 0 { - code = 500 - } - - return &GetPVCDescribeDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get p v c describe default response -func (o *GetPVCDescribeDefault) WithStatusCode(code int) *GetPVCDescribeDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get p v c describe default response -func (o *GetPVCDescribeDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get p v c describe default response -func (o *GetPVCDescribeDefault) WithPayload(payload *models.Error) *GetPVCDescribeDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get p v c describe default response -func (o *GetPVCDescribeDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetPVCDescribeDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/get_p_v_c_describe_urlbuilder.go b/operatorapi/operations/operator_api/get_p_v_c_describe_urlbuilder.go deleted file mode 100644 index 704dc4322..000000000 --- a/operatorapi/operations/operator_api/get_p_v_c_describe_urlbuilder.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetPVCDescribeURL generates an URL for the get p v c describe operation -type GetPVCDescribeURL struct { - PVCName string - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetPVCDescribeURL) WithBasePath(bp string) *GetPVCDescribeURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetPVCDescribeURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetPVCDescribeURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/pvcs/{PVCName}/describe" - - pVCName := o.PVCName - if pVCName != "" { - _path = strings.Replace(_path, "{PVCName}", pVCName, -1) - } else { - return nil, errors.New("pVCName is required on GetPVCDescribeURL") - } - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on GetPVCDescribeURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on GetPVCDescribeURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetPVCDescribeURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetPVCDescribeURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetPVCDescribeURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetPVCDescribeURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetPVCDescribeURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetPVCDescribeURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/get_p_v_c_events.go b/operatorapi/operations/operator_api/get_p_v_c_events.go deleted file mode 100644 index c64de7db8..000000000 --- a/operatorapi/operations/operator_api/get_p_v_c_events.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// GetPVCEventsHandlerFunc turns a function with the right signature into a get p v c events handler -type GetPVCEventsHandlerFunc func(GetPVCEventsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetPVCEventsHandlerFunc) Handle(params GetPVCEventsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetPVCEventsHandler interface for that can handle valid get p v c events params -type GetPVCEventsHandler interface { - Handle(GetPVCEventsParams, *models.Principal) middleware.Responder -} - -// NewGetPVCEvents creates a new http.Handler for the get p v c events operation -func NewGetPVCEvents(ctx *middleware.Context, handler GetPVCEventsHandler) *GetPVCEvents { - return &GetPVCEvents{Context: ctx, Handler: handler} -} - -/* - GetPVCEvents swagger:route GET /namespaces/{namespace}/tenants/{tenant}/pvcs/{PVCName}/events OperatorAPI getPVCEvents - -Get Events for PVC -*/ -type GetPVCEvents struct { - Context *middleware.Context - Handler GetPVCEventsHandler -} - -func (o *GetPVCEvents) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetPVCEventsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/get_p_v_c_events_parameters.go b/operatorapi/operations/operator_api/get_p_v_c_events_parameters.go deleted file mode 100644 index 18a4f3e2d..000000000 --- a/operatorapi/operations/operator_api/get_p_v_c_events_parameters.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetPVCEventsParams creates a new GetPVCEventsParams object -// -// There are no default values defined in the spec. -func NewGetPVCEventsParams() GetPVCEventsParams { - - return GetPVCEventsParams{} -} - -// GetPVCEventsParams contains all the bound params for the get p v c events operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetPVCEvents -type GetPVCEventsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - PVCName string - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetPVCEventsParams() beforehand. -func (o *GetPVCEventsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rPVCName, rhkPVCName, _ := route.Params.GetOK("PVCName") - if err := o.bindPVCName(rPVCName, rhkPVCName, route.Formats); err != nil { - res = append(res, err) - } - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindPVCName binds and validates parameter PVCName from path. -func (o *GetPVCEventsParams) bindPVCName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.PVCName = raw - - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *GetPVCEventsParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *GetPVCEventsParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/get_p_v_c_events_responses.go b/operatorapi/operations/operator_api/get_p_v_c_events_responses.go deleted file mode 100644 index 2b28d8a71..000000000 --- a/operatorapi/operations/operator_api/get_p_v_c_events_responses.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// GetPVCEventsOKCode is the HTTP code returned for type GetPVCEventsOK -const GetPVCEventsOKCode int = 200 - -/* -GetPVCEventsOK A successful response. - -swagger:response getPVCEventsOK -*/ -type GetPVCEventsOK struct { - - /* - In: Body - */ - Payload models.EventListWrapper `json:"body,omitempty"` -} - -// NewGetPVCEventsOK creates GetPVCEventsOK with default headers values -func NewGetPVCEventsOK() *GetPVCEventsOK { - - return &GetPVCEventsOK{} -} - -// WithPayload adds the payload to the get p v c events o k response -func (o *GetPVCEventsOK) WithPayload(payload models.EventListWrapper) *GetPVCEventsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get p v c events o k response -func (o *GetPVCEventsOK) SetPayload(payload models.EventListWrapper) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetPVCEventsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.EventListWrapper{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetPVCEventsDefault Generic error response. - -swagger:response getPVCEventsDefault -*/ -type GetPVCEventsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetPVCEventsDefault creates GetPVCEventsDefault with default headers values -func NewGetPVCEventsDefault(code int) *GetPVCEventsDefault { - if code <= 0 { - code = 500 - } - - return &GetPVCEventsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get p v c events default response -func (o *GetPVCEventsDefault) WithStatusCode(code int) *GetPVCEventsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get p v c events default response -func (o *GetPVCEventsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get p v c events default response -func (o *GetPVCEventsDefault) WithPayload(payload *models.Error) *GetPVCEventsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get p v c events default response -func (o *GetPVCEventsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetPVCEventsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/get_p_v_c_events_urlbuilder.go b/operatorapi/operations/operator_api/get_p_v_c_events_urlbuilder.go deleted file mode 100644 index ef894ccf1..000000000 --- a/operatorapi/operations/operator_api/get_p_v_c_events_urlbuilder.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetPVCEventsURL generates an URL for the get p v c events operation -type GetPVCEventsURL struct { - PVCName string - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetPVCEventsURL) WithBasePath(bp string) *GetPVCEventsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetPVCEventsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetPVCEventsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/pvcs/{PVCName}/events" - - pVCName := o.PVCName - if pVCName != "" { - _path = strings.Replace(_path, "{PVCName}", pVCName, -1) - } else { - return nil, errors.New("pVCName is required on GetPVCEventsURL") - } - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on GetPVCEventsURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on GetPVCEventsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetPVCEventsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetPVCEventsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetPVCEventsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetPVCEventsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetPVCEventsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetPVCEventsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/get_parity.go b/operatorapi/operations/operator_api/get_parity.go deleted file mode 100644 index 8dffe609d..000000000 --- a/operatorapi/operations/operator_api/get_parity.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// GetParityHandlerFunc turns a function with the right signature into a get parity handler -type GetParityHandlerFunc func(GetParityParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetParityHandlerFunc) Handle(params GetParityParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetParityHandler interface for that can handle valid get parity params -type GetParityHandler interface { - Handle(GetParityParams, *models.Principal) middleware.Responder -} - -// NewGetParity creates a new http.Handler for the get parity operation -func NewGetParity(ctx *middleware.Context, handler GetParityHandler) *GetParity { - return &GetParity{Context: ctx, Handler: handler} -} - -/* - GetParity swagger:route GET /get-parity/{nodes}/{disksPerNode} OperatorAPI getParity - -Gets parity by sending number of nodes & number of disks -*/ -type GetParity struct { - Context *middleware.Context - Handler GetParityHandler -} - -func (o *GetParity) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetParityParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/get_parity_parameters.go b/operatorapi/operations/operator_api/get_parity_parameters.go deleted file mode 100644 index 2e28a8925..000000000 --- a/operatorapi/operations/operator_api/get_parity_parameters.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewGetParityParams creates a new GetParityParams object -// -// There are no default values defined in the spec. -func NewGetParityParams() GetParityParams { - - return GetParityParams{} -} - -// GetParityParams contains all the bound params for the get parity operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetParity -type GetParityParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - Minimum: 1 - In: path - */ - DisksPerNode int64 - /* - Required: true - Minimum: 2 - In: path - */ - Nodes int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetParityParams() beforehand. -func (o *GetParityParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rDisksPerNode, rhkDisksPerNode, _ := route.Params.GetOK("disksPerNode") - if err := o.bindDisksPerNode(rDisksPerNode, rhkDisksPerNode, route.Formats); err != nil { - res = append(res, err) - } - - rNodes, rhkNodes, _ := route.Params.GetOK("nodes") - if err := o.bindNodes(rNodes, rhkNodes, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindDisksPerNode binds and validates parameter DisksPerNode from path. -func (o *GetParityParams) bindDisksPerNode(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("disksPerNode", "path", "int64", raw) - } - o.DisksPerNode = value - - if err := o.validateDisksPerNode(formats); err != nil { - return err - } - - return nil -} - -// validateDisksPerNode carries on validations for parameter DisksPerNode -func (o *GetParityParams) validateDisksPerNode(formats strfmt.Registry) error { - - if err := validate.MinimumInt("disksPerNode", "path", o.DisksPerNode, 1, false); err != nil { - return err - } - - return nil -} - -// bindNodes binds and validates parameter Nodes from path. -func (o *GetParityParams) bindNodes(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("nodes", "path", "int64", raw) - } - o.Nodes = value - - if err := o.validateNodes(formats); err != nil { - return err - } - - return nil -} - -// validateNodes carries on validations for parameter Nodes -func (o *GetParityParams) validateNodes(formats strfmt.Registry) error { - - if err := validate.MinimumInt("nodes", "path", o.Nodes, 2, false); err != nil { - return err - } - - return nil -} diff --git a/operatorapi/operations/operator_api/get_parity_responses.go b/operatorapi/operations/operator_api/get_parity_responses.go deleted file mode 100644 index c9c4f1f46..000000000 --- a/operatorapi/operations/operator_api/get_parity_responses.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// GetParityOKCode is the HTTP code returned for type GetParityOK -const GetParityOKCode int = 200 - -/* -GetParityOK A successful response. - -swagger:response getParityOK -*/ -type GetParityOK struct { - - /* - In: Body - */ - Payload models.ParityResponse `json:"body,omitempty"` -} - -// NewGetParityOK creates GetParityOK with default headers values -func NewGetParityOK() *GetParityOK { - - return &GetParityOK{} -} - -// WithPayload adds the payload to the get parity o k response -func (o *GetParityOK) WithPayload(payload models.ParityResponse) *GetParityOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get parity o k response -func (o *GetParityOK) SetPayload(payload models.ParityResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetParityOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.ParityResponse{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetParityDefault Generic error response. - -swagger:response getParityDefault -*/ -type GetParityDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetParityDefault creates GetParityDefault with default headers values -func NewGetParityDefault(code int) *GetParityDefault { - if code <= 0 { - code = 500 - } - - return &GetParityDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get parity default response -func (o *GetParityDefault) WithStatusCode(code int) *GetParityDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get parity default response -func (o *GetParityDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get parity default response -func (o *GetParityDefault) WithPayload(payload *models.Error) *GetParityDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get parity default response -func (o *GetParityDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetParityDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/get_parity_urlbuilder.go b/operatorapi/operations/operator_api/get_parity_urlbuilder.go deleted file mode 100644 index 560a89fb5..000000000 --- a/operatorapi/operations/operator_api/get_parity_urlbuilder.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetParityURL generates an URL for the get parity operation -type GetParityURL struct { - DisksPerNode int64 - Nodes int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetParityURL) WithBasePath(bp string) *GetParityURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetParityURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetParityURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/get-parity/{nodes}/{disksPerNode}" - - disksPerNode := swag.FormatInt64(o.DisksPerNode) - if disksPerNode != "" { - _path = strings.Replace(_path, "{disksPerNode}", disksPerNode, -1) - } else { - return nil, errors.New("disksPerNode is required on GetParityURL") - } - - nodes := swag.FormatInt64(o.Nodes) - if nodes != "" { - _path = strings.Replace(_path, "{nodes}", nodes, -1) - } else { - return nil, errors.New("nodes is required on GetParityURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetParityURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetParityURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetParityURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetParityURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetParityURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetParityURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/get_pod_events.go b/operatorapi/operations/operator_api/get_pod_events.go deleted file mode 100644 index 3d019515b..000000000 --- a/operatorapi/operations/operator_api/get_pod_events.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// GetPodEventsHandlerFunc turns a function with the right signature into a get pod events handler -type GetPodEventsHandlerFunc func(GetPodEventsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetPodEventsHandlerFunc) Handle(params GetPodEventsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetPodEventsHandler interface for that can handle valid get pod events params -type GetPodEventsHandler interface { - Handle(GetPodEventsParams, *models.Principal) middleware.Responder -} - -// NewGetPodEvents creates a new http.Handler for the get pod events operation -func NewGetPodEvents(ctx *middleware.Context, handler GetPodEventsHandler) *GetPodEvents { - return &GetPodEvents{Context: ctx, Handler: handler} -} - -/* - GetPodEvents swagger:route GET /namespaces/{namespace}/tenants/{tenant}/pods/{podName}/events OperatorAPI getPodEvents - -Get Events for Pod -*/ -type GetPodEvents struct { - Context *middleware.Context - Handler GetPodEventsHandler -} - -func (o *GetPodEvents) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetPodEventsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/get_pod_events_parameters.go b/operatorapi/operations/operator_api/get_pod_events_parameters.go deleted file mode 100644 index c44ab9ddd..000000000 --- a/operatorapi/operations/operator_api/get_pod_events_parameters.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetPodEventsParams creates a new GetPodEventsParams object -// -// There are no default values defined in the spec. -func NewGetPodEventsParams() GetPodEventsParams { - - return GetPodEventsParams{} -} - -// GetPodEventsParams contains all the bound params for the get pod events operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetPodEvents -type GetPodEventsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - PodName string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetPodEventsParams() beforehand. -func (o *GetPodEventsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rPodName, rhkPodName, _ := route.Params.GetOK("podName") - if err := o.bindPodName(rPodName, rhkPodName, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *GetPodEventsParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindPodName binds and validates parameter PodName from path. -func (o *GetPodEventsParams) bindPodName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.PodName = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *GetPodEventsParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/get_pod_events_responses.go b/operatorapi/operations/operator_api/get_pod_events_responses.go deleted file mode 100644 index 33decfa76..000000000 --- a/operatorapi/operations/operator_api/get_pod_events_responses.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// GetPodEventsOKCode is the HTTP code returned for type GetPodEventsOK -const GetPodEventsOKCode int = 200 - -/* -GetPodEventsOK A successful response. - -swagger:response getPodEventsOK -*/ -type GetPodEventsOK struct { - - /* - In: Body - */ - Payload models.EventListWrapper `json:"body,omitempty"` -} - -// NewGetPodEventsOK creates GetPodEventsOK with default headers values -func NewGetPodEventsOK() *GetPodEventsOK { - - return &GetPodEventsOK{} -} - -// WithPayload adds the payload to the get pod events o k response -func (o *GetPodEventsOK) WithPayload(payload models.EventListWrapper) *GetPodEventsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get pod events o k response -func (o *GetPodEventsOK) SetPayload(payload models.EventListWrapper) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetPodEventsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.EventListWrapper{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetPodEventsDefault Generic error response. - -swagger:response getPodEventsDefault -*/ -type GetPodEventsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetPodEventsDefault creates GetPodEventsDefault with default headers values -func NewGetPodEventsDefault(code int) *GetPodEventsDefault { - if code <= 0 { - code = 500 - } - - return &GetPodEventsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get pod events default response -func (o *GetPodEventsDefault) WithStatusCode(code int) *GetPodEventsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get pod events default response -func (o *GetPodEventsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get pod events default response -func (o *GetPodEventsDefault) WithPayload(payload *models.Error) *GetPodEventsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get pod events default response -func (o *GetPodEventsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetPodEventsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/get_pod_events_urlbuilder.go b/operatorapi/operations/operator_api/get_pod_events_urlbuilder.go deleted file mode 100644 index 6551fab4d..000000000 --- a/operatorapi/operations/operator_api/get_pod_events_urlbuilder.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetPodEventsURL generates an URL for the get pod events operation -type GetPodEventsURL struct { - Namespace string - PodName string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetPodEventsURL) WithBasePath(bp string) *GetPodEventsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetPodEventsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetPodEventsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/pods/{podName}/events" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on GetPodEventsURL") - } - - podName := o.PodName - if podName != "" { - _path = strings.Replace(_path, "{podName}", podName, -1) - } else { - return nil, errors.New("podName is required on GetPodEventsURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on GetPodEventsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetPodEventsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetPodEventsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetPodEventsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetPodEventsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetPodEventsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetPodEventsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/get_pod_logs.go b/operatorapi/operations/operator_api/get_pod_logs.go deleted file mode 100644 index 15336fd5d..000000000 --- a/operatorapi/operations/operator_api/get_pod_logs.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// GetPodLogsHandlerFunc turns a function with the right signature into a get pod logs handler -type GetPodLogsHandlerFunc func(GetPodLogsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetPodLogsHandlerFunc) Handle(params GetPodLogsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetPodLogsHandler interface for that can handle valid get pod logs params -type GetPodLogsHandler interface { - Handle(GetPodLogsParams, *models.Principal) middleware.Responder -} - -// NewGetPodLogs creates a new http.Handler for the get pod logs operation -func NewGetPodLogs(ctx *middleware.Context, handler GetPodLogsHandler) *GetPodLogs { - return &GetPodLogs{Context: ctx, Handler: handler} -} - -/* - GetPodLogs swagger:route GET /namespaces/{namespace}/tenants/{tenant}/pods/{podName} OperatorAPI getPodLogs - -Get Logs for Pod -*/ -type GetPodLogs struct { - Context *middleware.Context - Handler GetPodLogsHandler -} - -func (o *GetPodLogs) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetPodLogsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/get_pod_logs_parameters.go b/operatorapi/operations/operator_api/get_pod_logs_parameters.go deleted file mode 100644 index fe28b0e2c..000000000 --- a/operatorapi/operations/operator_api/get_pod_logs_parameters.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetPodLogsParams creates a new GetPodLogsParams object -// -// There are no default values defined in the spec. -func NewGetPodLogsParams() GetPodLogsParams { - - return GetPodLogsParams{} -} - -// GetPodLogsParams contains all the bound params for the get pod logs operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetPodLogs -type GetPodLogsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - PodName string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetPodLogsParams() beforehand. -func (o *GetPodLogsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rPodName, rhkPodName, _ := route.Params.GetOK("podName") - if err := o.bindPodName(rPodName, rhkPodName, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *GetPodLogsParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindPodName binds and validates parameter PodName from path. -func (o *GetPodLogsParams) bindPodName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.PodName = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *GetPodLogsParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/get_pod_logs_responses.go b/operatorapi/operations/operator_api/get_pod_logs_responses.go deleted file mode 100644 index 8ff33d152..000000000 --- a/operatorapi/operations/operator_api/get_pod_logs_responses.go +++ /dev/null @@ -1,133 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// GetPodLogsOKCode is the HTTP code returned for type GetPodLogsOK -const GetPodLogsOKCode int = 200 - -/* -GetPodLogsOK A successful response. - -swagger:response getPodLogsOK -*/ -type GetPodLogsOK struct { - - /* - In: Body - */ - Payload string `json:"body,omitempty"` -} - -// NewGetPodLogsOK creates GetPodLogsOK with default headers values -func NewGetPodLogsOK() *GetPodLogsOK { - - return &GetPodLogsOK{} -} - -// WithPayload adds the payload to the get pod logs o k response -func (o *GetPodLogsOK) WithPayload(payload string) *GetPodLogsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get pod logs o k response -func (o *GetPodLogsOK) SetPayload(payload string) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetPodLogsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetPodLogsDefault Generic error response. - -swagger:response getPodLogsDefault -*/ -type GetPodLogsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetPodLogsDefault creates GetPodLogsDefault with default headers values -func NewGetPodLogsDefault(code int) *GetPodLogsDefault { - if code <= 0 { - code = 500 - } - - return &GetPodLogsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get pod logs default response -func (o *GetPodLogsDefault) WithStatusCode(code int) *GetPodLogsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get pod logs default response -func (o *GetPodLogsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get pod logs default response -func (o *GetPodLogsDefault) WithPayload(payload *models.Error) *GetPodLogsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get pod logs default response -func (o *GetPodLogsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetPodLogsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/get_pod_logs_urlbuilder.go b/operatorapi/operations/operator_api/get_pod_logs_urlbuilder.go deleted file mode 100644 index 1ca92ddf1..000000000 --- a/operatorapi/operations/operator_api/get_pod_logs_urlbuilder.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetPodLogsURL generates an URL for the get pod logs operation -type GetPodLogsURL struct { - Namespace string - PodName string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetPodLogsURL) WithBasePath(bp string) *GetPodLogsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetPodLogsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetPodLogsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/pods/{podName}" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on GetPodLogsURL") - } - - podName := o.PodName - if podName != "" { - _path = strings.Replace(_path, "{podName}", podName, -1) - } else { - return nil, errors.New("podName is required on GetPodLogsURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on GetPodLogsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetPodLogsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetPodLogsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetPodLogsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetPodLogsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetPodLogsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetPodLogsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/get_resource_quota.go b/operatorapi/operations/operator_api/get_resource_quota.go deleted file mode 100644 index b162bfead..000000000 --- a/operatorapi/operations/operator_api/get_resource_quota.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// GetResourceQuotaHandlerFunc turns a function with the right signature into a get resource quota handler -type GetResourceQuotaHandlerFunc func(GetResourceQuotaParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetResourceQuotaHandlerFunc) Handle(params GetResourceQuotaParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetResourceQuotaHandler interface for that can handle valid get resource quota params -type GetResourceQuotaHandler interface { - Handle(GetResourceQuotaParams, *models.Principal) middleware.Responder -} - -// NewGetResourceQuota creates a new http.Handler for the get resource quota operation -func NewGetResourceQuota(ctx *middleware.Context, handler GetResourceQuotaHandler) *GetResourceQuota { - return &GetResourceQuota{Context: ctx, Handler: handler} -} - -/* - GetResourceQuota swagger:route GET /namespaces/{namespace}/resourcequotas/{resource-quota-name} OperatorAPI getResourceQuota - -Get Resource Quota -*/ -type GetResourceQuota struct { - Context *middleware.Context - Handler GetResourceQuotaHandler -} - -func (o *GetResourceQuota) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetResourceQuotaParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/get_resource_quota_parameters.go b/operatorapi/operations/operator_api/get_resource_quota_parameters.go deleted file mode 100644 index d3b356496..000000000 --- a/operatorapi/operations/operator_api/get_resource_quota_parameters.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetResourceQuotaParams creates a new GetResourceQuotaParams object -// -// There are no default values defined in the spec. -func NewGetResourceQuotaParams() GetResourceQuotaParams { - - return GetResourceQuotaParams{} -} - -// GetResourceQuotaParams contains all the bound params for the get resource quota operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetResourceQuota -type GetResourceQuotaParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - ResourceQuotaName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetResourceQuotaParams() beforehand. -func (o *GetResourceQuotaParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rResourceQuotaName, rhkResourceQuotaName, _ := route.Params.GetOK("resource-quota-name") - if err := o.bindResourceQuotaName(rResourceQuotaName, rhkResourceQuotaName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *GetResourceQuotaParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindResourceQuotaName binds and validates parameter ResourceQuotaName from path. -func (o *GetResourceQuotaParams) bindResourceQuotaName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ResourceQuotaName = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/get_resource_quota_responses.go b/operatorapi/operations/operator_api/get_resource_quota_responses.go deleted file mode 100644 index 996c46c22..000000000 --- a/operatorapi/operations/operator_api/get_resource_quota_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// GetResourceQuotaOKCode is the HTTP code returned for type GetResourceQuotaOK -const GetResourceQuotaOKCode int = 200 - -/* -GetResourceQuotaOK A successful response. - -swagger:response getResourceQuotaOK -*/ -type GetResourceQuotaOK struct { - - /* - In: Body - */ - Payload *models.ResourceQuota `json:"body,omitempty"` -} - -// NewGetResourceQuotaOK creates GetResourceQuotaOK with default headers values -func NewGetResourceQuotaOK() *GetResourceQuotaOK { - - return &GetResourceQuotaOK{} -} - -// WithPayload adds the payload to the get resource quota o k response -func (o *GetResourceQuotaOK) WithPayload(payload *models.ResourceQuota) *GetResourceQuotaOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get resource quota o k response -func (o *GetResourceQuotaOK) SetPayload(payload *models.ResourceQuota) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetResourceQuotaOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetResourceQuotaDefault Generic error response. - -swagger:response getResourceQuotaDefault -*/ -type GetResourceQuotaDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetResourceQuotaDefault creates GetResourceQuotaDefault with default headers values -func NewGetResourceQuotaDefault(code int) *GetResourceQuotaDefault { - if code <= 0 { - code = 500 - } - - return &GetResourceQuotaDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get resource quota default response -func (o *GetResourceQuotaDefault) WithStatusCode(code int) *GetResourceQuotaDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get resource quota default response -func (o *GetResourceQuotaDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get resource quota default response -func (o *GetResourceQuotaDefault) WithPayload(payload *models.Error) *GetResourceQuotaDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get resource quota default response -func (o *GetResourceQuotaDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetResourceQuotaDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/get_resource_quota_urlbuilder.go b/operatorapi/operations/operator_api/get_resource_quota_urlbuilder.go deleted file mode 100644 index a5931cbe8..000000000 --- a/operatorapi/operations/operator_api/get_resource_quota_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetResourceQuotaURL generates an URL for the get resource quota operation -type GetResourceQuotaURL struct { - Namespace string - ResourceQuotaName string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetResourceQuotaURL) WithBasePath(bp string) *GetResourceQuotaURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetResourceQuotaURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetResourceQuotaURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/resourcequotas/{resource-quota-name}" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on GetResourceQuotaURL") - } - - resourceQuotaName := o.ResourceQuotaName - if resourceQuotaName != "" { - _path = strings.Replace(_path, "{resource-quota-name}", resourceQuotaName, -1) - } else { - return nil, errors.New("resourceQuotaName is required on GetResourceQuotaURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetResourceQuotaURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetResourceQuotaURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetResourceQuotaURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetResourceQuotaURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetResourceQuotaURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetResourceQuotaURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/get_tenant_events.go b/operatorapi/operations/operator_api/get_tenant_events.go deleted file mode 100644 index cde40cc4f..000000000 --- a/operatorapi/operations/operator_api/get_tenant_events.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// GetTenantEventsHandlerFunc turns a function with the right signature into a get tenant events handler -type GetTenantEventsHandlerFunc func(GetTenantEventsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTenantEventsHandlerFunc) Handle(params GetTenantEventsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetTenantEventsHandler interface for that can handle valid get tenant events params -type GetTenantEventsHandler interface { - Handle(GetTenantEventsParams, *models.Principal) middleware.Responder -} - -// NewGetTenantEvents creates a new http.Handler for the get tenant events operation -func NewGetTenantEvents(ctx *middleware.Context, handler GetTenantEventsHandler) *GetTenantEvents { - return &GetTenantEvents{Context: ctx, Handler: handler} -} - -/* - GetTenantEvents swagger:route GET /namespaces/{namespace}/tenants/{tenant}/events OperatorAPI getTenantEvents - -Get Events for given Tenant -*/ -type GetTenantEvents struct { - Context *middleware.Context - Handler GetTenantEventsHandler -} - -func (o *GetTenantEvents) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTenantEventsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/get_tenant_events_parameters.go b/operatorapi/operations/operator_api/get_tenant_events_parameters.go deleted file mode 100644 index 2411c4050..000000000 --- a/operatorapi/operations/operator_api/get_tenant_events_parameters.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetTenantEventsParams creates a new GetTenantEventsParams object -// -// There are no default values defined in the spec. -func NewGetTenantEventsParams() GetTenantEventsParams { - - return GetTenantEventsParams{} -} - -// GetTenantEventsParams contains all the bound params for the get tenant events operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetTenantEvents -type GetTenantEventsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetTenantEventsParams() beforehand. -func (o *GetTenantEventsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *GetTenantEventsParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *GetTenantEventsParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/get_tenant_events_responses.go b/operatorapi/operations/operator_api/get_tenant_events_responses.go deleted file mode 100644 index 6bdef76ba..000000000 --- a/operatorapi/operations/operator_api/get_tenant_events_responses.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// GetTenantEventsOKCode is the HTTP code returned for type GetTenantEventsOK -const GetTenantEventsOKCode int = 200 - -/* -GetTenantEventsOK A successful response. - -swagger:response getTenantEventsOK -*/ -type GetTenantEventsOK struct { - - /* - In: Body - */ - Payload models.EventListWrapper `json:"body,omitempty"` -} - -// NewGetTenantEventsOK creates GetTenantEventsOK with default headers values -func NewGetTenantEventsOK() *GetTenantEventsOK { - - return &GetTenantEventsOK{} -} - -// WithPayload adds the payload to the get tenant events o k response -func (o *GetTenantEventsOK) WithPayload(payload models.EventListWrapper) *GetTenantEventsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get tenant events o k response -func (o *GetTenantEventsOK) SetPayload(payload models.EventListWrapper) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTenantEventsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.EventListWrapper{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetTenantEventsDefault Generic error response. - -swagger:response getTenantEventsDefault -*/ -type GetTenantEventsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTenantEventsDefault creates GetTenantEventsDefault with default headers values -func NewGetTenantEventsDefault(code int) *GetTenantEventsDefault { - if code <= 0 { - code = 500 - } - - return &GetTenantEventsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get tenant events default response -func (o *GetTenantEventsDefault) WithStatusCode(code int) *GetTenantEventsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get tenant events default response -func (o *GetTenantEventsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get tenant events default response -func (o *GetTenantEventsDefault) WithPayload(payload *models.Error) *GetTenantEventsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get tenant events default response -func (o *GetTenantEventsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTenantEventsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/get_tenant_events_urlbuilder.go b/operatorapi/operations/operator_api/get_tenant_events_urlbuilder.go deleted file mode 100644 index 45c29edf2..000000000 --- a/operatorapi/operations/operator_api/get_tenant_events_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetTenantEventsURL generates an URL for the get tenant events operation -type GetTenantEventsURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTenantEventsURL) WithBasePath(bp string) *GetTenantEventsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTenantEventsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTenantEventsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/events" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on GetTenantEventsURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on GetTenantEventsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetTenantEventsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetTenantEventsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTenantEventsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTenantEventsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTenantEventsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetTenantEventsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/get_tenant_logs.go b/operatorapi/operations/operator_api/get_tenant_logs.go deleted file mode 100644 index c32d06d4f..000000000 --- a/operatorapi/operations/operator_api/get_tenant_logs.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// GetTenantLogsHandlerFunc turns a function with the right signature into a get tenant logs handler -type GetTenantLogsHandlerFunc func(GetTenantLogsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTenantLogsHandlerFunc) Handle(params GetTenantLogsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetTenantLogsHandler interface for that can handle valid get tenant logs params -type GetTenantLogsHandler interface { - Handle(GetTenantLogsParams, *models.Principal) middleware.Responder -} - -// NewGetTenantLogs creates a new http.Handler for the get tenant logs operation -func NewGetTenantLogs(ctx *middleware.Context, handler GetTenantLogsHandler) *GetTenantLogs { - return &GetTenantLogs{Context: ctx, Handler: handler} -} - -/* - GetTenantLogs swagger:route GET /namespaces/{namespace}/tenants/{tenant}/log OperatorAPI getTenantLogs - -Get Tenant Logs -*/ -type GetTenantLogs struct { - Context *middleware.Context - Handler GetTenantLogsHandler -} - -func (o *GetTenantLogs) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTenantLogsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/get_tenant_logs_parameters.go b/operatorapi/operations/operator_api/get_tenant_logs_parameters.go deleted file mode 100644 index d245cced1..000000000 --- a/operatorapi/operations/operator_api/get_tenant_logs_parameters.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetTenantLogsParams creates a new GetTenantLogsParams object -// -// There are no default values defined in the spec. -func NewGetTenantLogsParams() GetTenantLogsParams { - - return GetTenantLogsParams{} -} - -// GetTenantLogsParams contains all the bound params for the get tenant logs operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetTenantLogs -type GetTenantLogsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetTenantLogsParams() beforehand. -func (o *GetTenantLogsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *GetTenantLogsParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *GetTenantLogsParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/get_tenant_logs_responses.go b/operatorapi/operations/operator_api/get_tenant_logs_responses.go deleted file mode 100644 index 51d4d65e1..000000000 --- a/operatorapi/operations/operator_api/get_tenant_logs_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// GetTenantLogsOKCode is the HTTP code returned for type GetTenantLogsOK -const GetTenantLogsOKCode int = 200 - -/* -GetTenantLogsOK A successful response. - -swagger:response getTenantLogsOK -*/ -type GetTenantLogsOK struct { - - /* - In: Body - */ - Payload *models.TenantLogs `json:"body,omitempty"` -} - -// NewGetTenantLogsOK creates GetTenantLogsOK with default headers values -func NewGetTenantLogsOK() *GetTenantLogsOK { - - return &GetTenantLogsOK{} -} - -// WithPayload adds the payload to the get tenant logs o k response -func (o *GetTenantLogsOK) WithPayload(payload *models.TenantLogs) *GetTenantLogsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get tenant logs o k response -func (o *GetTenantLogsOK) SetPayload(payload *models.TenantLogs) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTenantLogsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetTenantLogsDefault Generic error response. - -swagger:response getTenantLogsDefault -*/ -type GetTenantLogsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTenantLogsDefault creates GetTenantLogsDefault with default headers values -func NewGetTenantLogsDefault(code int) *GetTenantLogsDefault { - if code <= 0 { - code = 500 - } - - return &GetTenantLogsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get tenant logs default response -func (o *GetTenantLogsDefault) WithStatusCode(code int) *GetTenantLogsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get tenant logs default response -func (o *GetTenantLogsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get tenant logs default response -func (o *GetTenantLogsDefault) WithPayload(payload *models.Error) *GetTenantLogsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get tenant logs default response -func (o *GetTenantLogsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTenantLogsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/get_tenant_logs_urlbuilder.go b/operatorapi/operations/operator_api/get_tenant_logs_urlbuilder.go deleted file mode 100644 index feb6b8029..000000000 --- a/operatorapi/operations/operator_api/get_tenant_logs_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetTenantLogsURL generates an URL for the get tenant logs operation -type GetTenantLogsURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTenantLogsURL) WithBasePath(bp string) *GetTenantLogsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTenantLogsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTenantLogsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/log" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on GetTenantLogsURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on GetTenantLogsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetTenantLogsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetTenantLogsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTenantLogsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTenantLogsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTenantLogsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetTenantLogsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/get_tenant_monitoring.go b/operatorapi/operations/operator_api/get_tenant_monitoring.go deleted file mode 100644 index f52659058..000000000 --- a/operatorapi/operations/operator_api/get_tenant_monitoring.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// GetTenantMonitoringHandlerFunc turns a function with the right signature into a get tenant monitoring handler -type GetTenantMonitoringHandlerFunc func(GetTenantMonitoringParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTenantMonitoringHandlerFunc) Handle(params GetTenantMonitoringParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetTenantMonitoringHandler interface for that can handle valid get tenant monitoring params -type GetTenantMonitoringHandler interface { - Handle(GetTenantMonitoringParams, *models.Principal) middleware.Responder -} - -// NewGetTenantMonitoring creates a new http.Handler for the get tenant monitoring operation -func NewGetTenantMonitoring(ctx *middleware.Context, handler GetTenantMonitoringHandler) *GetTenantMonitoring { - return &GetTenantMonitoring{Context: ctx, Handler: handler} -} - -/* - GetTenantMonitoring swagger:route GET /namespaces/{namespace}/tenants/{tenant}/monitoring OperatorAPI getTenantMonitoring - -Get Prometheus Monitoring config info For The Tenant -*/ -type GetTenantMonitoring struct { - Context *middleware.Context - Handler GetTenantMonitoringHandler -} - -func (o *GetTenantMonitoring) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTenantMonitoringParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/get_tenant_monitoring_parameters.go b/operatorapi/operations/operator_api/get_tenant_monitoring_parameters.go deleted file mode 100644 index 98624e03d..000000000 --- a/operatorapi/operations/operator_api/get_tenant_monitoring_parameters.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetTenantMonitoringParams creates a new GetTenantMonitoringParams object -// -// There are no default values defined in the spec. -func NewGetTenantMonitoringParams() GetTenantMonitoringParams { - - return GetTenantMonitoringParams{} -} - -// GetTenantMonitoringParams contains all the bound params for the get tenant monitoring operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetTenantMonitoring -type GetTenantMonitoringParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetTenantMonitoringParams() beforehand. -func (o *GetTenantMonitoringParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *GetTenantMonitoringParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *GetTenantMonitoringParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/get_tenant_monitoring_responses.go b/operatorapi/operations/operator_api/get_tenant_monitoring_responses.go deleted file mode 100644 index c7f499424..000000000 --- a/operatorapi/operations/operator_api/get_tenant_monitoring_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// GetTenantMonitoringOKCode is the HTTP code returned for type GetTenantMonitoringOK -const GetTenantMonitoringOKCode int = 200 - -/* -GetTenantMonitoringOK A successful response. - -swagger:response getTenantMonitoringOK -*/ -type GetTenantMonitoringOK struct { - - /* - In: Body - */ - Payload *models.TenantMonitoringInfo `json:"body,omitempty"` -} - -// NewGetTenantMonitoringOK creates GetTenantMonitoringOK with default headers values -func NewGetTenantMonitoringOK() *GetTenantMonitoringOK { - - return &GetTenantMonitoringOK{} -} - -// WithPayload adds the payload to the get tenant monitoring o k response -func (o *GetTenantMonitoringOK) WithPayload(payload *models.TenantMonitoringInfo) *GetTenantMonitoringOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get tenant monitoring o k response -func (o *GetTenantMonitoringOK) SetPayload(payload *models.TenantMonitoringInfo) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTenantMonitoringOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetTenantMonitoringDefault Generic error response. - -swagger:response getTenantMonitoringDefault -*/ -type GetTenantMonitoringDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTenantMonitoringDefault creates GetTenantMonitoringDefault with default headers values -func NewGetTenantMonitoringDefault(code int) *GetTenantMonitoringDefault { - if code <= 0 { - code = 500 - } - - return &GetTenantMonitoringDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get tenant monitoring default response -func (o *GetTenantMonitoringDefault) WithStatusCode(code int) *GetTenantMonitoringDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get tenant monitoring default response -func (o *GetTenantMonitoringDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get tenant monitoring default response -func (o *GetTenantMonitoringDefault) WithPayload(payload *models.Error) *GetTenantMonitoringDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get tenant monitoring default response -func (o *GetTenantMonitoringDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTenantMonitoringDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/get_tenant_monitoring_urlbuilder.go b/operatorapi/operations/operator_api/get_tenant_monitoring_urlbuilder.go deleted file mode 100644 index 243edc10e..000000000 --- a/operatorapi/operations/operator_api/get_tenant_monitoring_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetTenantMonitoringURL generates an URL for the get tenant monitoring operation -type GetTenantMonitoringURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTenantMonitoringURL) WithBasePath(bp string) *GetTenantMonitoringURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTenantMonitoringURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTenantMonitoringURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/monitoring" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on GetTenantMonitoringURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on GetTenantMonitoringURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetTenantMonitoringURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetTenantMonitoringURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTenantMonitoringURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTenantMonitoringURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTenantMonitoringURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetTenantMonitoringURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/get_tenant_pods.go b/operatorapi/operations/operator_api/get_tenant_pods.go deleted file mode 100644 index 122684311..000000000 --- a/operatorapi/operations/operator_api/get_tenant_pods.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// GetTenantPodsHandlerFunc turns a function with the right signature into a get tenant pods handler -type GetTenantPodsHandlerFunc func(GetTenantPodsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTenantPodsHandlerFunc) Handle(params GetTenantPodsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetTenantPodsHandler interface for that can handle valid get tenant pods params -type GetTenantPodsHandler interface { - Handle(GetTenantPodsParams, *models.Principal) middleware.Responder -} - -// NewGetTenantPods creates a new http.Handler for the get tenant pods operation -func NewGetTenantPods(ctx *middleware.Context, handler GetTenantPodsHandler) *GetTenantPods { - return &GetTenantPods{Context: ctx, Handler: handler} -} - -/* - GetTenantPods swagger:route GET /namespaces/{namespace}/tenants/{tenant}/pods OperatorAPI getTenantPods - -Get Pods For The Tenant -*/ -type GetTenantPods struct { - Context *middleware.Context - Handler GetTenantPodsHandler -} - -func (o *GetTenantPods) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTenantPodsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/get_tenant_pods_parameters.go b/operatorapi/operations/operator_api/get_tenant_pods_parameters.go deleted file mode 100644 index 0eeb0dcbe..000000000 --- a/operatorapi/operations/operator_api/get_tenant_pods_parameters.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetTenantPodsParams creates a new GetTenantPodsParams object -// -// There are no default values defined in the spec. -func NewGetTenantPodsParams() GetTenantPodsParams { - - return GetTenantPodsParams{} -} - -// GetTenantPodsParams contains all the bound params for the get tenant pods operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetTenantPods -type GetTenantPodsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetTenantPodsParams() beforehand. -func (o *GetTenantPodsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *GetTenantPodsParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *GetTenantPodsParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/get_tenant_pods_responses.go b/operatorapi/operations/operator_api/get_tenant_pods_responses.go deleted file mode 100644 index 773c78830..000000000 --- a/operatorapi/operations/operator_api/get_tenant_pods_responses.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// GetTenantPodsOKCode is the HTTP code returned for type GetTenantPodsOK -const GetTenantPodsOKCode int = 200 - -/* -GetTenantPodsOK A successful response. - -swagger:response getTenantPodsOK -*/ -type GetTenantPodsOK struct { - - /* - In: Body - */ - Payload []*models.TenantPod `json:"body,omitempty"` -} - -// NewGetTenantPodsOK creates GetTenantPodsOK with default headers values -func NewGetTenantPodsOK() *GetTenantPodsOK { - - return &GetTenantPodsOK{} -} - -// WithPayload adds the payload to the get tenant pods o k response -func (o *GetTenantPodsOK) WithPayload(payload []*models.TenantPod) *GetTenantPodsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get tenant pods o k response -func (o *GetTenantPodsOK) SetPayload(payload []*models.TenantPod) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTenantPodsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = make([]*models.TenantPod, 0, 50) - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetTenantPodsDefault Generic error response. - -swagger:response getTenantPodsDefault -*/ -type GetTenantPodsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTenantPodsDefault creates GetTenantPodsDefault with default headers values -func NewGetTenantPodsDefault(code int) *GetTenantPodsDefault { - if code <= 0 { - code = 500 - } - - return &GetTenantPodsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get tenant pods default response -func (o *GetTenantPodsDefault) WithStatusCode(code int) *GetTenantPodsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get tenant pods default response -func (o *GetTenantPodsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get tenant pods default response -func (o *GetTenantPodsDefault) WithPayload(payload *models.Error) *GetTenantPodsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get tenant pods default response -func (o *GetTenantPodsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTenantPodsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/get_tenant_pods_urlbuilder.go b/operatorapi/operations/operator_api/get_tenant_pods_urlbuilder.go deleted file mode 100644 index 768cfe59b..000000000 --- a/operatorapi/operations/operator_api/get_tenant_pods_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetTenantPodsURL generates an URL for the get tenant pods operation -type GetTenantPodsURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTenantPodsURL) WithBasePath(bp string) *GetTenantPodsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTenantPodsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTenantPodsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/pods" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on GetTenantPodsURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on GetTenantPodsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetTenantPodsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetTenantPodsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTenantPodsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTenantPodsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTenantPodsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetTenantPodsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/get_tenant_usage.go b/operatorapi/operations/operator_api/get_tenant_usage.go deleted file mode 100644 index b48a1f91a..000000000 --- a/operatorapi/operations/operator_api/get_tenant_usage.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// GetTenantUsageHandlerFunc turns a function with the right signature into a get tenant usage handler -type GetTenantUsageHandlerFunc func(GetTenantUsageParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTenantUsageHandlerFunc) Handle(params GetTenantUsageParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetTenantUsageHandler interface for that can handle valid get tenant usage params -type GetTenantUsageHandler interface { - Handle(GetTenantUsageParams, *models.Principal) middleware.Responder -} - -// NewGetTenantUsage creates a new http.Handler for the get tenant usage operation -func NewGetTenantUsage(ctx *middleware.Context, handler GetTenantUsageHandler) *GetTenantUsage { - return &GetTenantUsage{Context: ctx, Handler: handler} -} - -/* - GetTenantUsage swagger:route GET /namespaces/{namespace}/tenants/{tenant}/usage OperatorAPI getTenantUsage - -Get Usage For The Tenant -*/ -type GetTenantUsage struct { - Context *middleware.Context - Handler GetTenantUsageHandler -} - -func (o *GetTenantUsage) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTenantUsageParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/get_tenant_usage_parameters.go b/operatorapi/operations/operator_api/get_tenant_usage_parameters.go deleted file mode 100644 index 71a0eb142..000000000 --- a/operatorapi/operations/operator_api/get_tenant_usage_parameters.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetTenantUsageParams creates a new GetTenantUsageParams object -// -// There are no default values defined in the spec. -func NewGetTenantUsageParams() GetTenantUsageParams { - - return GetTenantUsageParams{} -} - -// GetTenantUsageParams contains all the bound params for the get tenant usage operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetTenantUsage -type GetTenantUsageParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetTenantUsageParams() beforehand. -func (o *GetTenantUsageParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *GetTenantUsageParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *GetTenantUsageParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/get_tenant_usage_responses.go b/operatorapi/operations/operator_api/get_tenant_usage_responses.go deleted file mode 100644 index e30fce35a..000000000 --- a/operatorapi/operations/operator_api/get_tenant_usage_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// GetTenantUsageOKCode is the HTTP code returned for type GetTenantUsageOK -const GetTenantUsageOKCode int = 200 - -/* -GetTenantUsageOK A successful response. - -swagger:response getTenantUsageOK -*/ -type GetTenantUsageOK struct { - - /* - In: Body - */ - Payload *models.TenantUsage `json:"body,omitempty"` -} - -// NewGetTenantUsageOK creates GetTenantUsageOK with default headers values -func NewGetTenantUsageOK() *GetTenantUsageOK { - - return &GetTenantUsageOK{} -} - -// WithPayload adds the payload to the get tenant usage o k response -func (o *GetTenantUsageOK) WithPayload(payload *models.TenantUsage) *GetTenantUsageOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get tenant usage o k response -func (o *GetTenantUsageOK) SetPayload(payload *models.TenantUsage) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTenantUsageOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetTenantUsageDefault Generic error response. - -swagger:response getTenantUsageDefault -*/ -type GetTenantUsageDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTenantUsageDefault creates GetTenantUsageDefault with default headers values -func NewGetTenantUsageDefault(code int) *GetTenantUsageDefault { - if code <= 0 { - code = 500 - } - - return &GetTenantUsageDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get tenant usage default response -func (o *GetTenantUsageDefault) WithStatusCode(code int) *GetTenantUsageDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get tenant usage default response -func (o *GetTenantUsageDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get tenant usage default response -func (o *GetTenantUsageDefault) WithPayload(payload *models.Error) *GetTenantUsageDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get tenant usage default response -func (o *GetTenantUsageDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTenantUsageDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/get_tenant_usage_urlbuilder.go b/operatorapi/operations/operator_api/get_tenant_usage_urlbuilder.go deleted file mode 100644 index 0701d5295..000000000 --- a/operatorapi/operations/operator_api/get_tenant_usage_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetTenantUsageURL generates an URL for the get tenant usage operation -type GetTenantUsageURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTenantUsageURL) WithBasePath(bp string) *GetTenantUsageURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTenantUsageURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTenantUsageURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/usage" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on GetTenantUsageURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on GetTenantUsageURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetTenantUsageURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetTenantUsageURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTenantUsageURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTenantUsageURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTenantUsageURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetTenantUsageURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/get_tenant_y_a_m_l.go b/operatorapi/operations/operator_api/get_tenant_y_a_m_l.go deleted file mode 100644 index aad387020..000000000 --- a/operatorapi/operations/operator_api/get_tenant_y_a_m_l.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// GetTenantYAMLHandlerFunc turns a function with the right signature into a get tenant y a m l handler -type GetTenantYAMLHandlerFunc func(GetTenantYAMLParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTenantYAMLHandlerFunc) Handle(params GetTenantYAMLParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetTenantYAMLHandler interface for that can handle valid get tenant y a m l params -type GetTenantYAMLHandler interface { - Handle(GetTenantYAMLParams, *models.Principal) middleware.Responder -} - -// NewGetTenantYAML creates a new http.Handler for the get tenant y a m l operation -func NewGetTenantYAML(ctx *middleware.Context, handler GetTenantYAMLHandler) *GetTenantYAML { - return &GetTenantYAML{Context: ctx, Handler: handler} -} - -/* - GetTenantYAML swagger:route GET /namespaces/{namespace}/tenants/{tenant}/yaml OperatorAPI getTenantYAML - -Get the Tenant YAML -*/ -type GetTenantYAML struct { - Context *middleware.Context - Handler GetTenantYAMLHandler -} - -func (o *GetTenantYAML) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTenantYAMLParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/get_tenant_y_a_m_l_parameters.go b/operatorapi/operations/operator_api/get_tenant_y_a_m_l_parameters.go deleted file mode 100644 index 57e8cca7a..000000000 --- a/operatorapi/operations/operator_api/get_tenant_y_a_m_l_parameters.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetTenantYAMLParams creates a new GetTenantYAMLParams object -// -// There are no default values defined in the spec. -func NewGetTenantYAMLParams() GetTenantYAMLParams { - - return GetTenantYAMLParams{} -} - -// GetTenantYAMLParams contains all the bound params for the get tenant y a m l operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetTenantYAML -type GetTenantYAMLParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetTenantYAMLParams() beforehand. -func (o *GetTenantYAMLParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *GetTenantYAMLParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *GetTenantYAMLParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/get_tenant_y_a_m_l_responses.go b/operatorapi/operations/operator_api/get_tenant_y_a_m_l_responses.go deleted file mode 100644 index fd871ab5e..000000000 --- a/operatorapi/operations/operator_api/get_tenant_y_a_m_l_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// GetTenantYAMLOKCode is the HTTP code returned for type GetTenantYAMLOK -const GetTenantYAMLOKCode int = 200 - -/* -GetTenantYAMLOK A successful response. - -swagger:response getTenantYAMLOK -*/ -type GetTenantYAMLOK struct { - - /* - In: Body - */ - Payload *models.TenantYAML `json:"body,omitempty"` -} - -// NewGetTenantYAMLOK creates GetTenantYAMLOK with default headers values -func NewGetTenantYAMLOK() *GetTenantYAMLOK { - - return &GetTenantYAMLOK{} -} - -// WithPayload adds the payload to the get tenant y a m l o k response -func (o *GetTenantYAMLOK) WithPayload(payload *models.TenantYAML) *GetTenantYAMLOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get tenant y a m l o k response -func (o *GetTenantYAMLOK) SetPayload(payload *models.TenantYAML) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTenantYAMLOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetTenantYAMLDefault Generic error response. - -swagger:response getTenantYAMLDefault -*/ -type GetTenantYAMLDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTenantYAMLDefault creates GetTenantYAMLDefault with default headers values -func NewGetTenantYAMLDefault(code int) *GetTenantYAMLDefault { - if code <= 0 { - code = 500 - } - - return &GetTenantYAMLDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get tenant y a m l default response -func (o *GetTenantYAMLDefault) WithStatusCode(code int) *GetTenantYAMLDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get tenant y a m l default response -func (o *GetTenantYAMLDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get tenant y a m l default response -func (o *GetTenantYAMLDefault) WithPayload(payload *models.Error) *GetTenantYAMLDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get tenant y a m l default response -func (o *GetTenantYAMLDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTenantYAMLDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/get_tenant_y_a_m_l_urlbuilder.go b/operatorapi/operations/operator_api/get_tenant_y_a_m_l_urlbuilder.go deleted file mode 100644 index 363e69c4f..000000000 --- a/operatorapi/operations/operator_api/get_tenant_y_a_m_l_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetTenantYAMLURL generates an URL for the get tenant y a m l operation -type GetTenantYAMLURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTenantYAMLURL) WithBasePath(bp string) *GetTenantYAMLURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTenantYAMLURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTenantYAMLURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/yaml" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on GetTenantYAMLURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on GetTenantYAMLURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetTenantYAMLURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetTenantYAMLURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTenantYAMLURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTenantYAMLURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTenantYAMLURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetTenantYAMLURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/list_all_tenants.go b/operatorapi/operations/operator_api/list_all_tenants.go deleted file mode 100644 index 76d6c198d..000000000 --- a/operatorapi/operations/operator_api/list_all_tenants.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// ListAllTenantsHandlerFunc turns a function with the right signature into a list all tenants handler -type ListAllTenantsHandlerFunc func(ListAllTenantsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListAllTenantsHandlerFunc) Handle(params ListAllTenantsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListAllTenantsHandler interface for that can handle valid list all tenants params -type ListAllTenantsHandler interface { - Handle(ListAllTenantsParams, *models.Principal) middleware.Responder -} - -// NewListAllTenants creates a new http.Handler for the list all tenants operation -func NewListAllTenants(ctx *middleware.Context, handler ListAllTenantsHandler) *ListAllTenants { - return &ListAllTenants{Context: ctx, Handler: handler} -} - -/* - ListAllTenants swagger:route GET /tenants OperatorAPI listAllTenants - -List Tenant of All Namespaces -*/ -type ListAllTenants struct { - Context *middleware.Context - Handler ListAllTenantsHandler -} - -func (o *ListAllTenants) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListAllTenantsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/list_all_tenants_parameters.go b/operatorapi/operations/operator_api/list_all_tenants_parameters.go deleted file mode 100644 index d7887a17e..000000000 --- a/operatorapi/operations/operator_api/list_all_tenants_parameters.go +++ /dev/null @@ -1,159 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewListAllTenantsParams creates a new ListAllTenantsParams object -// -// There are no default values defined in the spec. -func NewListAllTenantsParams() ListAllTenantsParams { - - return ListAllTenantsParams{} -} - -// ListAllTenantsParams contains all the bound params for the list all tenants operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListAllTenants -type ListAllTenantsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - In: query - */ - Limit *int32 - /* - In: query - */ - Offset *int32 - /* - In: query - */ - SortBy *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewListAllTenantsParams() beforehand. -func (o *ListAllTenantsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qLimit, qhkLimit, _ := qs.GetOK("limit") - if err := o.bindLimit(qLimit, qhkLimit, route.Formats); err != nil { - res = append(res, err) - } - - qOffset, qhkOffset, _ := qs.GetOK("offset") - if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { - res = append(res, err) - } - - qSortBy, qhkSortBy, _ := qs.GetOK("sort_by") - if err := o.bindSortBy(qSortBy, qhkSortBy, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindLimit binds and validates parameter Limit from query. -func (o *ListAllTenantsParams) bindLimit(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("limit", "query", "int32", raw) - } - o.Limit = &value - - return nil -} - -// bindOffset binds and validates parameter Offset from query. -func (o *ListAllTenantsParams) bindOffset(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("offset", "query", "int32", raw) - } - o.Offset = &value - - return nil -} - -// bindSortBy binds and validates parameter SortBy from query. -func (o *ListAllTenantsParams) bindSortBy(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.SortBy = &raw - - return nil -} diff --git a/operatorapi/operations/operator_api/list_all_tenants_responses.go b/operatorapi/operations/operator_api/list_all_tenants_responses.go deleted file mode 100644 index dcae1697f..000000000 --- a/operatorapi/operations/operator_api/list_all_tenants_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// ListAllTenantsOKCode is the HTTP code returned for type ListAllTenantsOK -const ListAllTenantsOKCode int = 200 - -/* -ListAllTenantsOK A successful response. - -swagger:response listAllTenantsOK -*/ -type ListAllTenantsOK struct { - - /* - In: Body - */ - Payload *models.ListTenantsResponse `json:"body,omitempty"` -} - -// NewListAllTenantsOK creates ListAllTenantsOK with default headers values -func NewListAllTenantsOK() *ListAllTenantsOK { - - return &ListAllTenantsOK{} -} - -// WithPayload adds the payload to the list all tenants o k response -func (o *ListAllTenantsOK) WithPayload(payload *models.ListTenantsResponse) *ListAllTenantsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list all tenants o k response -func (o *ListAllTenantsOK) SetPayload(payload *models.ListTenantsResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListAllTenantsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ListAllTenantsDefault Generic error response. - -swagger:response listAllTenantsDefault -*/ -type ListAllTenantsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewListAllTenantsDefault creates ListAllTenantsDefault with default headers values -func NewListAllTenantsDefault(code int) *ListAllTenantsDefault { - if code <= 0 { - code = 500 - } - - return &ListAllTenantsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list all tenants default response -func (o *ListAllTenantsDefault) WithStatusCode(code int) *ListAllTenantsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list all tenants default response -func (o *ListAllTenantsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list all tenants default response -func (o *ListAllTenantsDefault) WithPayload(payload *models.Error) *ListAllTenantsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list all tenants default response -func (o *ListAllTenantsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListAllTenantsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/list_all_tenants_urlbuilder.go b/operatorapi/operations/operator_api/list_all_tenants_urlbuilder.go deleted file mode 100644 index ecb25203e..000000000 --- a/operatorapi/operations/operator_api/list_all_tenants_urlbuilder.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// ListAllTenantsURL generates an URL for the list all tenants operation -type ListAllTenantsURL struct { - Limit *int32 - Offset *int32 - SortBy *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ListAllTenantsURL) WithBasePath(bp string) *ListAllTenantsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ListAllTenantsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListAllTenantsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/tenants" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var limitQ string - if o.Limit != nil { - limitQ = swag.FormatInt32(*o.Limit) - } - if limitQ != "" { - qs.Set("limit", limitQ) - } - - var offsetQ string - if o.Offset != nil { - offsetQ = swag.FormatInt32(*o.Offset) - } - if offsetQ != "" { - qs.Set("offset", offsetQ) - } - - var sortByQ string - if o.SortBy != nil { - sortByQ = *o.SortBy - } - if sortByQ != "" { - qs.Set("sort_by", sortByQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ListAllTenantsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ListAllTenantsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListAllTenantsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListAllTenantsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListAllTenantsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ListAllTenantsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/list_node_labels.go b/operatorapi/operations/operator_api/list_node_labels.go deleted file mode 100644 index 621d1406c..000000000 --- a/operatorapi/operations/operator_api/list_node_labels.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// ListNodeLabelsHandlerFunc turns a function with the right signature into a list node labels handler -type ListNodeLabelsHandlerFunc func(ListNodeLabelsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListNodeLabelsHandlerFunc) Handle(params ListNodeLabelsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListNodeLabelsHandler interface for that can handle valid list node labels params -type ListNodeLabelsHandler interface { - Handle(ListNodeLabelsParams, *models.Principal) middleware.Responder -} - -// NewListNodeLabels creates a new http.Handler for the list node labels operation -func NewListNodeLabels(ctx *middleware.Context, handler ListNodeLabelsHandler) *ListNodeLabels { - return &ListNodeLabels{Context: ctx, Handler: handler} -} - -/* - ListNodeLabels swagger:route GET /nodes/labels OperatorAPI listNodeLabels - -List node labels -*/ -type ListNodeLabels struct { - Context *middleware.Context - Handler ListNodeLabelsHandler -} - -func (o *ListNodeLabels) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListNodeLabelsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/list_node_labels_parameters.go b/operatorapi/operations/operator_api/list_node_labels_parameters.go deleted file mode 100644 index 4eb270888..000000000 --- a/operatorapi/operations/operator_api/list_node_labels_parameters.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewListNodeLabelsParams creates a new ListNodeLabelsParams object -// -// There are no default values defined in the spec. -func NewListNodeLabelsParams() ListNodeLabelsParams { - - return ListNodeLabelsParams{} -} - -// ListNodeLabelsParams contains all the bound params for the list node labels operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListNodeLabels -type ListNodeLabelsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewListNodeLabelsParams() beforehand. -func (o *ListNodeLabelsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/operator_api/list_node_labels_responses.go b/operatorapi/operations/operator_api/list_node_labels_responses.go deleted file mode 100644 index 057204730..000000000 --- a/operatorapi/operations/operator_api/list_node_labels_responses.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// ListNodeLabelsOKCode is the HTTP code returned for type ListNodeLabelsOK -const ListNodeLabelsOKCode int = 200 - -/* -ListNodeLabelsOK A successful response. - -swagger:response listNodeLabelsOK -*/ -type ListNodeLabelsOK struct { - - /* - In: Body - */ - Payload models.NodeLabels `json:"body,omitempty"` -} - -// NewListNodeLabelsOK creates ListNodeLabelsOK with default headers values -func NewListNodeLabelsOK() *ListNodeLabelsOK { - - return &ListNodeLabelsOK{} -} - -// WithPayload adds the payload to the list node labels o k response -func (o *ListNodeLabelsOK) WithPayload(payload models.NodeLabels) *ListNodeLabelsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list node labels o k response -func (o *ListNodeLabelsOK) SetPayload(payload models.NodeLabels) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListNodeLabelsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty map - payload = models.NodeLabels{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -ListNodeLabelsDefault Generic error response. - -swagger:response listNodeLabelsDefault -*/ -type ListNodeLabelsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewListNodeLabelsDefault creates ListNodeLabelsDefault with default headers values -func NewListNodeLabelsDefault(code int) *ListNodeLabelsDefault { - if code <= 0 { - code = 500 - } - - return &ListNodeLabelsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list node labels default response -func (o *ListNodeLabelsDefault) WithStatusCode(code int) *ListNodeLabelsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list node labels default response -func (o *ListNodeLabelsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list node labels default response -func (o *ListNodeLabelsDefault) WithPayload(payload *models.Error) *ListNodeLabelsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list node labels default response -func (o *ListNodeLabelsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListNodeLabelsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/list_node_labels_urlbuilder.go b/operatorapi/operations/operator_api/list_node_labels_urlbuilder.go deleted file mode 100644 index b289a545a..000000000 --- a/operatorapi/operations/operator_api/list_node_labels_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// ListNodeLabelsURL generates an URL for the list node labels operation -type ListNodeLabelsURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ListNodeLabelsURL) WithBasePath(bp string) *ListNodeLabelsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ListNodeLabelsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListNodeLabelsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/nodes/labels" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ListNodeLabelsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ListNodeLabelsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListNodeLabelsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListNodeLabelsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListNodeLabelsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ListNodeLabelsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/list_p_v_cs.go b/operatorapi/operations/operator_api/list_p_v_cs.go deleted file mode 100644 index 1eda89336..000000000 --- a/operatorapi/operations/operator_api/list_p_v_cs.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// ListPVCsHandlerFunc turns a function with the right signature into a list p v cs handler -type ListPVCsHandlerFunc func(ListPVCsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListPVCsHandlerFunc) Handle(params ListPVCsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListPVCsHandler interface for that can handle valid list p v cs params -type ListPVCsHandler interface { - Handle(ListPVCsParams, *models.Principal) middleware.Responder -} - -// NewListPVCs creates a new http.Handler for the list p v cs operation -func NewListPVCs(ctx *middleware.Context, handler ListPVCsHandler) *ListPVCs { - return &ListPVCs{Context: ctx, Handler: handler} -} - -/* - ListPVCs swagger:route GET /list-pvcs OperatorAPI listPVCs - -List all PVCs from namespaces that the user has access to -*/ -type ListPVCs struct { - Context *middleware.Context - Handler ListPVCsHandler -} - -func (o *ListPVCs) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListPVCsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/list_p_v_cs_for_tenant.go b/operatorapi/operations/operator_api/list_p_v_cs_for_tenant.go deleted file mode 100644 index 4487d9df2..000000000 --- a/operatorapi/operations/operator_api/list_p_v_cs_for_tenant.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// ListPVCsForTenantHandlerFunc turns a function with the right signature into a list p v cs for tenant handler -type ListPVCsForTenantHandlerFunc func(ListPVCsForTenantParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListPVCsForTenantHandlerFunc) Handle(params ListPVCsForTenantParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListPVCsForTenantHandler interface for that can handle valid list p v cs for tenant params -type ListPVCsForTenantHandler interface { - Handle(ListPVCsForTenantParams, *models.Principal) middleware.Responder -} - -// NewListPVCsForTenant creates a new http.Handler for the list p v cs for tenant operation -func NewListPVCsForTenant(ctx *middleware.Context, handler ListPVCsForTenantHandler) *ListPVCsForTenant { - return &ListPVCsForTenant{Context: ctx, Handler: handler} -} - -/* - ListPVCsForTenant swagger:route GET /namespaces/{namespace}/tenants/{tenant}/pvcs OperatorAPI listPVCsForTenant - -List all PVCs from given Tenant -*/ -type ListPVCsForTenant struct { - Context *middleware.Context - Handler ListPVCsForTenantHandler -} - -func (o *ListPVCsForTenant) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListPVCsForTenantParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/list_p_v_cs_for_tenant_parameters.go b/operatorapi/operations/operator_api/list_p_v_cs_for_tenant_parameters.go deleted file mode 100644 index e35dcc8b2..000000000 --- a/operatorapi/operations/operator_api/list_p_v_cs_for_tenant_parameters.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewListPVCsForTenantParams creates a new ListPVCsForTenantParams object -// -// There are no default values defined in the spec. -func NewListPVCsForTenantParams() ListPVCsForTenantParams { - - return ListPVCsForTenantParams{} -} - -// ListPVCsForTenantParams contains all the bound params for the list p v cs for tenant operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListPVCsForTenant -type ListPVCsForTenantParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewListPVCsForTenantParams() beforehand. -func (o *ListPVCsForTenantParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *ListPVCsForTenantParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *ListPVCsForTenantParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/list_p_v_cs_for_tenant_responses.go b/operatorapi/operations/operator_api/list_p_v_cs_for_tenant_responses.go deleted file mode 100644 index c90614a5f..000000000 --- a/operatorapi/operations/operator_api/list_p_v_cs_for_tenant_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// ListPVCsForTenantOKCode is the HTTP code returned for type ListPVCsForTenantOK -const ListPVCsForTenantOKCode int = 200 - -/* -ListPVCsForTenantOK A successful response. - -swagger:response listPVCsForTenantOK -*/ -type ListPVCsForTenantOK struct { - - /* - In: Body - */ - Payload *models.ListPVCsResponse `json:"body,omitempty"` -} - -// NewListPVCsForTenantOK creates ListPVCsForTenantOK with default headers values -func NewListPVCsForTenantOK() *ListPVCsForTenantOK { - - return &ListPVCsForTenantOK{} -} - -// WithPayload adds the payload to the list p v cs for tenant o k response -func (o *ListPVCsForTenantOK) WithPayload(payload *models.ListPVCsResponse) *ListPVCsForTenantOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list p v cs for tenant o k response -func (o *ListPVCsForTenantOK) SetPayload(payload *models.ListPVCsResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListPVCsForTenantOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ListPVCsForTenantDefault Generic error response. - -swagger:response listPVCsForTenantDefault -*/ -type ListPVCsForTenantDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewListPVCsForTenantDefault creates ListPVCsForTenantDefault with default headers values -func NewListPVCsForTenantDefault(code int) *ListPVCsForTenantDefault { - if code <= 0 { - code = 500 - } - - return &ListPVCsForTenantDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list p v cs for tenant default response -func (o *ListPVCsForTenantDefault) WithStatusCode(code int) *ListPVCsForTenantDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list p v cs for tenant default response -func (o *ListPVCsForTenantDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list p v cs for tenant default response -func (o *ListPVCsForTenantDefault) WithPayload(payload *models.Error) *ListPVCsForTenantDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list p v cs for tenant default response -func (o *ListPVCsForTenantDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListPVCsForTenantDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/list_p_v_cs_for_tenant_urlbuilder.go b/operatorapi/operations/operator_api/list_p_v_cs_for_tenant_urlbuilder.go deleted file mode 100644 index 0667c7849..000000000 --- a/operatorapi/operations/operator_api/list_p_v_cs_for_tenant_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// ListPVCsForTenantURL generates an URL for the list p v cs for tenant operation -type ListPVCsForTenantURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ListPVCsForTenantURL) WithBasePath(bp string) *ListPVCsForTenantURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ListPVCsForTenantURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListPVCsForTenantURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/pvcs" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on ListPVCsForTenantURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on ListPVCsForTenantURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ListPVCsForTenantURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ListPVCsForTenantURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListPVCsForTenantURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListPVCsForTenantURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListPVCsForTenantURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ListPVCsForTenantURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/list_p_v_cs_parameters.go b/operatorapi/operations/operator_api/list_p_v_cs_parameters.go deleted file mode 100644 index 15c531d16..000000000 --- a/operatorapi/operations/operator_api/list_p_v_cs_parameters.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewListPVCsParams creates a new ListPVCsParams object -// -// There are no default values defined in the spec. -func NewListPVCsParams() ListPVCsParams { - - return ListPVCsParams{} -} - -// ListPVCsParams contains all the bound params for the list p v cs operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListPVCs -type ListPVCsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewListPVCsParams() beforehand. -func (o *ListPVCsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/operator_api/list_p_v_cs_responses.go b/operatorapi/operations/operator_api/list_p_v_cs_responses.go deleted file mode 100644 index 02a6986c7..000000000 --- a/operatorapi/operations/operator_api/list_p_v_cs_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// ListPVCsOKCode is the HTTP code returned for type ListPVCsOK -const ListPVCsOKCode int = 200 - -/* -ListPVCsOK A successful response. - -swagger:response listPVCsOK -*/ -type ListPVCsOK struct { - - /* - In: Body - */ - Payload *models.ListPVCsResponse `json:"body,omitempty"` -} - -// NewListPVCsOK creates ListPVCsOK with default headers values -func NewListPVCsOK() *ListPVCsOK { - - return &ListPVCsOK{} -} - -// WithPayload adds the payload to the list p v cs o k response -func (o *ListPVCsOK) WithPayload(payload *models.ListPVCsResponse) *ListPVCsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list p v cs o k response -func (o *ListPVCsOK) SetPayload(payload *models.ListPVCsResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListPVCsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ListPVCsDefault Generic error response. - -swagger:response listPVCsDefault -*/ -type ListPVCsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewListPVCsDefault creates ListPVCsDefault with default headers values -func NewListPVCsDefault(code int) *ListPVCsDefault { - if code <= 0 { - code = 500 - } - - return &ListPVCsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list p v cs default response -func (o *ListPVCsDefault) WithStatusCode(code int) *ListPVCsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list p v cs default response -func (o *ListPVCsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list p v cs default response -func (o *ListPVCsDefault) WithPayload(payload *models.Error) *ListPVCsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list p v cs default response -func (o *ListPVCsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListPVCsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/list_p_v_cs_urlbuilder.go b/operatorapi/operations/operator_api/list_p_v_cs_urlbuilder.go deleted file mode 100644 index e9428fc65..000000000 --- a/operatorapi/operations/operator_api/list_p_v_cs_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// ListPVCsURL generates an URL for the list p v cs operation -type ListPVCsURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ListPVCsURL) WithBasePath(bp string) *ListPVCsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ListPVCsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListPVCsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/list-pvcs" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ListPVCsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ListPVCsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListPVCsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListPVCsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListPVCsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ListPVCsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/list_tenant_certificate_signing_request.go b/operatorapi/operations/operator_api/list_tenant_certificate_signing_request.go deleted file mode 100644 index 63c12e447..000000000 --- a/operatorapi/operations/operator_api/list_tenant_certificate_signing_request.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// ListTenantCertificateSigningRequestHandlerFunc turns a function with the right signature into a list tenant certificate signing request handler -type ListTenantCertificateSigningRequestHandlerFunc func(ListTenantCertificateSigningRequestParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListTenantCertificateSigningRequestHandlerFunc) Handle(params ListTenantCertificateSigningRequestParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListTenantCertificateSigningRequestHandler interface for that can handle valid list tenant certificate signing request params -type ListTenantCertificateSigningRequestHandler interface { - Handle(ListTenantCertificateSigningRequestParams, *models.Principal) middleware.Responder -} - -// NewListTenantCertificateSigningRequest creates a new http.Handler for the list tenant certificate signing request operation -func NewListTenantCertificateSigningRequest(ctx *middleware.Context, handler ListTenantCertificateSigningRequestHandler) *ListTenantCertificateSigningRequest { - return &ListTenantCertificateSigningRequest{Context: ctx, Handler: handler} -} - -/* - ListTenantCertificateSigningRequest swagger:route GET /namespaces/{namespace}/tenants/{tenant}/csr OperatorAPI listTenantCertificateSigningRequest - -List Tenant Certificate Signing Request -*/ -type ListTenantCertificateSigningRequest struct { - Context *middleware.Context - Handler ListTenantCertificateSigningRequestHandler -} - -func (o *ListTenantCertificateSigningRequest) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListTenantCertificateSigningRequestParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/list_tenant_certificate_signing_request_parameters.go b/operatorapi/operations/operator_api/list_tenant_certificate_signing_request_parameters.go deleted file mode 100644 index 77c52a867..000000000 --- a/operatorapi/operations/operator_api/list_tenant_certificate_signing_request_parameters.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewListTenantCertificateSigningRequestParams creates a new ListTenantCertificateSigningRequestParams object -// -// There are no default values defined in the spec. -func NewListTenantCertificateSigningRequestParams() ListTenantCertificateSigningRequestParams { - - return ListTenantCertificateSigningRequestParams{} -} - -// ListTenantCertificateSigningRequestParams contains all the bound params for the list tenant certificate signing request operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListTenantCertificateSigningRequest -type ListTenantCertificateSigningRequestParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewListTenantCertificateSigningRequestParams() beforehand. -func (o *ListTenantCertificateSigningRequestParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *ListTenantCertificateSigningRequestParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *ListTenantCertificateSigningRequestParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/list_tenant_certificate_signing_request_responses.go b/operatorapi/operations/operator_api/list_tenant_certificate_signing_request_responses.go deleted file mode 100644 index e4c683083..000000000 --- a/operatorapi/operations/operator_api/list_tenant_certificate_signing_request_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// ListTenantCertificateSigningRequestOKCode is the HTTP code returned for type ListTenantCertificateSigningRequestOK -const ListTenantCertificateSigningRequestOKCode int = 200 - -/* -ListTenantCertificateSigningRequestOK A successful response. - -swagger:response listTenantCertificateSigningRequestOK -*/ -type ListTenantCertificateSigningRequestOK struct { - - /* - In: Body - */ - Payload *models.CsrElements `json:"body,omitempty"` -} - -// NewListTenantCertificateSigningRequestOK creates ListTenantCertificateSigningRequestOK with default headers values -func NewListTenantCertificateSigningRequestOK() *ListTenantCertificateSigningRequestOK { - - return &ListTenantCertificateSigningRequestOK{} -} - -// WithPayload adds the payload to the list tenant certificate signing request o k response -func (o *ListTenantCertificateSigningRequestOK) WithPayload(payload *models.CsrElements) *ListTenantCertificateSigningRequestOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list tenant certificate signing request o k response -func (o *ListTenantCertificateSigningRequestOK) SetPayload(payload *models.CsrElements) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListTenantCertificateSigningRequestOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ListTenantCertificateSigningRequestDefault Generic error response. - -swagger:response listTenantCertificateSigningRequestDefault -*/ -type ListTenantCertificateSigningRequestDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewListTenantCertificateSigningRequestDefault creates ListTenantCertificateSigningRequestDefault with default headers values -func NewListTenantCertificateSigningRequestDefault(code int) *ListTenantCertificateSigningRequestDefault { - if code <= 0 { - code = 500 - } - - return &ListTenantCertificateSigningRequestDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list tenant certificate signing request default response -func (o *ListTenantCertificateSigningRequestDefault) WithStatusCode(code int) *ListTenantCertificateSigningRequestDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list tenant certificate signing request default response -func (o *ListTenantCertificateSigningRequestDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list tenant certificate signing request default response -func (o *ListTenantCertificateSigningRequestDefault) WithPayload(payload *models.Error) *ListTenantCertificateSigningRequestDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list tenant certificate signing request default response -func (o *ListTenantCertificateSigningRequestDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListTenantCertificateSigningRequestDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/list_tenant_certificate_signing_request_urlbuilder.go b/operatorapi/operations/operator_api/list_tenant_certificate_signing_request_urlbuilder.go deleted file mode 100644 index d83aea20d..000000000 --- a/operatorapi/operations/operator_api/list_tenant_certificate_signing_request_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// ListTenantCertificateSigningRequestURL generates an URL for the list tenant certificate signing request operation -type ListTenantCertificateSigningRequestURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ListTenantCertificateSigningRequestURL) WithBasePath(bp string) *ListTenantCertificateSigningRequestURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ListTenantCertificateSigningRequestURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListTenantCertificateSigningRequestURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/csr" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on ListTenantCertificateSigningRequestURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on ListTenantCertificateSigningRequestURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ListTenantCertificateSigningRequestURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ListTenantCertificateSigningRequestURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListTenantCertificateSigningRequestURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListTenantCertificateSigningRequestURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListTenantCertificateSigningRequestURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ListTenantCertificateSigningRequestURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/list_tenants.go b/operatorapi/operations/operator_api/list_tenants.go deleted file mode 100644 index 827b600f8..000000000 --- a/operatorapi/operations/operator_api/list_tenants.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// ListTenantsHandlerFunc turns a function with the right signature into a list tenants handler -type ListTenantsHandlerFunc func(ListTenantsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListTenantsHandlerFunc) Handle(params ListTenantsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListTenantsHandler interface for that can handle valid list tenants params -type ListTenantsHandler interface { - Handle(ListTenantsParams, *models.Principal) middleware.Responder -} - -// NewListTenants creates a new http.Handler for the list tenants operation -func NewListTenants(ctx *middleware.Context, handler ListTenantsHandler) *ListTenants { - return &ListTenants{Context: ctx, Handler: handler} -} - -/* - ListTenants swagger:route GET /namespaces/{namespace}/tenants OperatorAPI listTenants - -List Tenants by Namespace -*/ -type ListTenants struct { - Context *middleware.Context - Handler ListTenantsHandler -} - -func (o *ListTenants) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListTenantsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/list_tenants_parameters.go b/operatorapi/operations/operator_api/list_tenants_parameters.go deleted file mode 100644 index 224c004aa..000000000 --- a/operatorapi/operations/operator_api/list_tenants_parameters.go +++ /dev/null @@ -1,183 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewListTenantsParams creates a new ListTenantsParams object -// -// There are no default values defined in the spec. -func NewListTenantsParams() ListTenantsParams { - - return ListTenantsParams{} -} - -// ListTenantsParams contains all the bound params for the list tenants operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListTenants -type ListTenantsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - In: query - */ - Limit *int32 - /* - Required: true - In: path - */ - Namespace string - /* - In: query - */ - Offset *int32 - /* - In: query - */ - SortBy *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewListTenantsParams() beforehand. -func (o *ListTenantsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qLimit, qhkLimit, _ := qs.GetOK("limit") - if err := o.bindLimit(qLimit, qhkLimit, route.Formats); err != nil { - res = append(res, err) - } - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - qOffset, qhkOffset, _ := qs.GetOK("offset") - if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { - res = append(res, err) - } - - qSortBy, qhkSortBy, _ := qs.GetOK("sort_by") - if err := o.bindSortBy(qSortBy, qhkSortBy, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindLimit binds and validates parameter Limit from query. -func (o *ListTenantsParams) bindLimit(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("limit", "query", "int32", raw) - } - o.Limit = &value - - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *ListTenantsParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindOffset binds and validates parameter Offset from query. -func (o *ListTenantsParams) bindOffset(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("offset", "query", "int32", raw) - } - o.Offset = &value - - return nil -} - -// bindSortBy binds and validates parameter SortBy from query. -func (o *ListTenantsParams) bindSortBy(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.SortBy = &raw - - return nil -} diff --git a/operatorapi/operations/operator_api/list_tenants_responses.go b/operatorapi/operations/operator_api/list_tenants_responses.go deleted file mode 100644 index d80968355..000000000 --- a/operatorapi/operations/operator_api/list_tenants_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// ListTenantsOKCode is the HTTP code returned for type ListTenantsOK -const ListTenantsOKCode int = 200 - -/* -ListTenantsOK A successful response. - -swagger:response listTenantsOK -*/ -type ListTenantsOK struct { - - /* - In: Body - */ - Payload *models.ListTenantsResponse `json:"body,omitempty"` -} - -// NewListTenantsOK creates ListTenantsOK with default headers values -func NewListTenantsOK() *ListTenantsOK { - - return &ListTenantsOK{} -} - -// WithPayload adds the payload to the list tenants o k response -func (o *ListTenantsOK) WithPayload(payload *models.ListTenantsResponse) *ListTenantsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list tenants o k response -func (o *ListTenantsOK) SetPayload(payload *models.ListTenantsResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListTenantsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ListTenantsDefault Generic error response. - -swagger:response listTenantsDefault -*/ -type ListTenantsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewListTenantsDefault creates ListTenantsDefault with default headers values -func NewListTenantsDefault(code int) *ListTenantsDefault { - if code <= 0 { - code = 500 - } - - return &ListTenantsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list tenants default response -func (o *ListTenantsDefault) WithStatusCode(code int) *ListTenantsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list tenants default response -func (o *ListTenantsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list tenants default response -func (o *ListTenantsDefault) WithPayload(payload *models.Error) *ListTenantsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list tenants default response -func (o *ListTenantsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListTenantsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/list_tenants_urlbuilder.go b/operatorapi/operations/operator_api/list_tenants_urlbuilder.go deleted file mode 100644 index 1500d0844..000000000 --- a/operatorapi/operations/operator_api/list_tenants_urlbuilder.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ListTenantsURL generates an URL for the list tenants operation -type ListTenantsURL struct { - Namespace string - - Limit *int32 - Offset *int32 - SortBy *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ListTenantsURL) WithBasePath(bp string) *ListTenantsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ListTenantsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListTenantsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on ListTenantsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var limitQ string - if o.Limit != nil { - limitQ = swag.FormatInt32(*o.Limit) - } - if limitQ != "" { - qs.Set("limit", limitQ) - } - - var offsetQ string - if o.Offset != nil { - offsetQ = swag.FormatInt32(*o.Offset) - } - if offsetQ != "" { - qs.Set("offset", offsetQ) - } - - var sortByQ string - if o.SortBy != nil { - sortByQ = *o.SortBy - } - if sortByQ != "" { - qs.Set("sort_by", sortByQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ListTenantsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ListTenantsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListTenantsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListTenantsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListTenantsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ListTenantsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/operator_subnet_api_key.go b/operatorapi/operations/operator_api/operator_subnet_api_key.go deleted file mode 100644 index 27183956a..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_api_key.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// OperatorSubnetAPIKeyHandlerFunc turns a function with the right signature into a operator subnet Api key handler -type OperatorSubnetAPIKeyHandlerFunc func(OperatorSubnetAPIKeyParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn OperatorSubnetAPIKeyHandlerFunc) Handle(params OperatorSubnetAPIKeyParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// OperatorSubnetAPIKeyHandler interface for that can handle valid operator subnet Api key params -type OperatorSubnetAPIKeyHandler interface { - Handle(OperatorSubnetAPIKeyParams, *models.Principal) middleware.Responder -} - -// NewOperatorSubnetAPIKey creates a new http.Handler for the operator subnet Api key operation -func NewOperatorSubnetAPIKey(ctx *middleware.Context, handler OperatorSubnetAPIKeyHandler) *OperatorSubnetAPIKey { - return &OperatorSubnetAPIKey{Context: ctx, Handler: handler} -} - -/* - OperatorSubnetAPIKey swagger:route GET /subnet/apikey OperatorAPI operatorSubnetApiKey - -Subnet api key -*/ -type OperatorSubnetAPIKey struct { - Context *middleware.Context - Handler OperatorSubnetAPIKeyHandler -} - -func (o *OperatorSubnetAPIKey) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewOperatorSubnetAPIKeyParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/operator_subnet_api_key_info.go b/operatorapi/operations/operator_api/operator_subnet_api_key_info.go deleted file mode 100644 index d559d37a6..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_api_key_info.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// OperatorSubnetAPIKeyInfoHandlerFunc turns a function with the right signature into a operator subnet API key info handler -type OperatorSubnetAPIKeyInfoHandlerFunc func(OperatorSubnetAPIKeyInfoParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn OperatorSubnetAPIKeyInfoHandlerFunc) Handle(params OperatorSubnetAPIKeyInfoParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// OperatorSubnetAPIKeyInfoHandler interface for that can handle valid operator subnet API key info params -type OperatorSubnetAPIKeyInfoHandler interface { - Handle(OperatorSubnetAPIKeyInfoParams, *models.Principal) middleware.Responder -} - -// NewOperatorSubnetAPIKeyInfo creates a new http.Handler for the operator subnet API key info operation -func NewOperatorSubnetAPIKeyInfo(ctx *middleware.Context, handler OperatorSubnetAPIKeyInfoHandler) *OperatorSubnetAPIKeyInfo { - return &OperatorSubnetAPIKeyInfo{Context: ctx, Handler: handler} -} - -/* - OperatorSubnetAPIKeyInfo swagger:route GET /subnet/apikey/info OperatorAPI operatorSubnetApiKeyInfo - -Subnet API key info -*/ -type OperatorSubnetAPIKeyInfo struct { - Context *middleware.Context - Handler OperatorSubnetAPIKeyInfoHandler -} - -func (o *OperatorSubnetAPIKeyInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewOperatorSubnetAPIKeyInfoParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/operator_subnet_api_key_info_parameters.go b/operatorapi/operations/operator_api/operator_subnet_api_key_info_parameters.go deleted file mode 100644 index 0f3125dcd..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_api_key_info_parameters.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewOperatorSubnetAPIKeyInfoParams creates a new OperatorSubnetAPIKeyInfoParams object -// -// There are no default values defined in the spec. -func NewOperatorSubnetAPIKeyInfoParams() OperatorSubnetAPIKeyInfoParams { - - return OperatorSubnetAPIKeyInfoParams{} -} - -// OperatorSubnetAPIKeyInfoParams contains all the bound params for the operator subnet API key info operation -// typically these are obtained from a http.Request -// -// swagger:parameters OperatorSubnetAPIKeyInfo -type OperatorSubnetAPIKeyInfoParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewOperatorSubnetAPIKeyInfoParams() beforehand. -func (o *OperatorSubnetAPIKeyInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/operator_api/operator_subnet_api_key_info_responses.go b/operatorapi/operations/operator_api/operator_subnet_api_key_info_responses.go deleted file mode 100644 index 8a58cd33c..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_api_key_info_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// OperatorSubnetAPIKeyInfoOKCode is the HTTP code returned for type OperatorSubnetAPIKeyInfoOK -const OperatorSubnetAPIKeyInfoOKCode int = 200 - -/* -OperatorSubnetAPIKeyInfoOK A successful response. - -swagger:response operatorSubnetApiKeyInfoOK -*/ -type OperatorSubnetAPIKeyInfoOK struct { - - /* - In: Body - */ - Payload *models.OperatorSubnetRegisterAPIKeyResponse `json:"body,omitempty"` -} - -// NewOperatorSubnetAPIKeyInfoOK creates OperatorSubnetAPIKeyInfoOK with default headers values -func NewOperatorSubnetAPIKeyInfoOK() *OperatorSubnetAPIKeyInfoOK { - - return &OperatorSubnetAPIKeyInfoOK{} -} - -// WithPayload adds the payload to the operator subnet Api key info o k response -func (o *OperatorSubnetAPIKeyInfoOK) WithPayload(payload *models.OperatorSubnetRegisterAPIKeyResponse) *OperatorSubnetAPIKeyInfoOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the operator subnet Api key info o k response -func (o *OperatorSubnetAPIKeyInfoOK) SetPayload(payload *models.OperatorSubnetRegisterAPIKeyResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *OperatorSubnetAPIKeyInfoOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -OperatorSubnetAPIKeyInfoDefault Generic error response. - -swagger:response operatorSubnetApiKeyInfoDefault -*/ -type OperatorSubnetAPIKeyInfoDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewOperatorSubnetAPIKeyInfoDefault creates OperatorSubnetAPIKeyInfoDefault with default headers values -func NewOperatorSubnetAPIKeyInfoDefault(code int) *OperatorSubnetAPIKeyInfoDefault { - if code <= 0 { - code = 500 - } - - return &OperatorSubnetAPIKeyInfoDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the operator subnet API key info default response -func (o *OperatorSubnetAPIKeyInfoDefault) WithStatusCode(code int) *OperatorSubnetAPIKeyInfoDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the operator subnet API key info default response -func (o *OperatorSubnetAPIKeyInfoDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the operator subnet API key info default response -func (o *OperatorSubnetAPIKeyInfoDefault) WithPayload(payload *models.Error) *OperatorSubnetAPIKeyInfoDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the operator subnet API key info default response -func (o *OperatorSubnetAPIKeyInfoDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *OperatorSubnetAPIKeyInfoDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/operator_subnet_api_key_info_urlbuilder.go b/operatorapi/operations/operator_api/operator_subnet_api_key_info_urlbuilder.go deleted file mode 100644 index d3328f689..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_api_key_info_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// OperatorSubnetAPIKeyInfoURL generates an URL for the operator subnet API key info operation -type OperatorSubnetAPIKeyInfoURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *OperatorSubnetAPIKeyInfoURL) WithBasePath(bp string) *OperatorSubnetAPIKeyInfoURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *OperatorSubnetAPIKeyInfoURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *OperatorSubnetAPIKeyInfoURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/subnet/apikey/info" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *OperatorSubnetAPIKeyInfoURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *OperatorSubnetAPIKeyInfoURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *OperatorSubnetAPIKeyInfoURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on OperatorSubnetAPIKeyInfoURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on OperatorSubnetAPIKeyInfoURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *OperatorSubnetAPIKeyInfoURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/operator_subnet_api_key_parameters.go b/operatorapi/operations/operator_api/operator_subnet_api_key_parameters.go deleted file mode 100644 index 6be40b1c5..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_api_key_parameters.go +++ /dev/null @@ -1,99 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewOperatorSubnetAPIKeyParams creates a new OperatorSubnetAPIKeyParams object -// -// There are no default values defined in the spec. -func NewOperatorSubnetAPIKeyParams() OperatorSubnetAPIKeyParams { - - return OperatorSubnetAPIKeyParams{} -} - -// OperatorSubnetAPIKeyParams contains all the bound params for the operator subnet Api key operation -// typically these are obtained from a http.Request -// -// swagger:parameters OperatorSubnetApiKey -type OperatorSubnetAPIKeyParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: query - */ - Token string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewOperatorSubnetAPIKeyParams() beforehand. -func (o *OperatorSubnetAPIKeyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qToken, qhkToken, _ := qs.GetOK("token") - if err := o.bindToken(qToken, qhkToken, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindToken binds and validates parameter Token from query. -func (o *OperatorSubnetAPIKeyParams) bindToken(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("token", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("token", "query", raw); err != nil { - return err - } - o.Token = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/operator_subnet_api_key_responses.go b/operatorapi/operations/operator_api/operator_subnet_api_key_responses.go deleted file mode 100644 index 7f5cd0ae0..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_api_key_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// OperatorSubnetAPIKeyOKCode is the HTTP code returned for type OperatorSubnetAPIKeyOK -const OperatorSubnetAPIKeyOKCode int = 200 - -/* -OperatorSubnetAPIKeyOK A successful response. - -swagger:response operatorSubnetApiKeyOK -*/ -type OperatorSubnetAPIKeyOK struct { - - /* - In: Body - */ - Payload *models.OperatorSubnetAPIKey `json:"body,omitempty"` -} - -// NewOperatorSubnetAPIKeyOK creates OperatorSubnetAPIKeyOK with default headers values -func NewOperatorSubnetAPIKeyOK() *OperatorSubnetAPIKeyOK { - - return &OperatorSubnetAPIKeyOK{} -} - -// WithPayload adds the payload to the operator subnet Api key o k response -func (o *OperatorSubnetAPIKeyOK) WithPayload(payload *models.OperatorSubnetAPIKey) *OperatorSubnetAPIKeyOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the operator subnet Api key o k response -func (o *OperatorSubnetAPIKeyOK) SetPayload(payload *models.OperatorSubnetAPIKey) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *OperatorSubnetAPIKeyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -OperatorSubnetAPIKeyDefault Generic error response. - -swagger:response operatorSubnetApiKeyDefault -*/ -type OperatorSubnetAPIKeyDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewOperatorSubnetAPIKeyDefault creates OperatorSubnetAPIKeyDefault with default headers values -func NewOperatorSubnetAPIKeyDefault(code int) *OperatorSubnetAPIKeyDefault { - if code <= 0 { - code = 500 - } - - return &OperatorSubnetAPIKeyDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the operator subnet Api key default response -func (o *OperatorSubnetAPIKeyDefault) WithStatusCode(code int) *OperatorSubnetAPIKeyDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the operator subnet Api key default response -func (o *OperatorSubnetAPIKeyDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the operator subnet Api key default response -func (o *OperatorSubnetAPIKeyDefault) WithPayload(payload *models.Error) *OperatorSubnetAPIKeyDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the operator subnet Api key default response -func (o *OperatorSubnetAPIKeyDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *OperatorSubnetAPIKeyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/operator_subnet_api_key_urlbuilder.go b/operatorapi/operations/operator_api/operator_subnet_api_key_urlbuilder.go deleted file mode 100644 index 0e0282c90..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_api_key_urlbuilder.go +++ /dev/null @@ -1,117 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// OperatorSubnetAPIKeyURL generates an URL for the operator subnet Api key operation -type OperatorSubnetAPIKeyURL struct { - Token string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *OperatorSubnetAPIKeyURL) WithBasePath(bp string) *OperatorSubnetAPIKeyURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *OperatorSubnetAPIKeyURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *OperatorSubnetAPIKeyURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/subnet/apikey" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - tokenQ := o.Token - if tokenQ != "" { - qs.Set("token", tokenQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *OperatorSubnetAPIKeyURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *OperatorSubnetAPIKeyURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *OperatorSubnetAPIKeyURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on OperatorSubnetAPIKeyURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on OperatorSubnetAPIKeyURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *OperatorSubnetAPIKeyURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/operator_subnet_login.go b/operatorapi/operations/operator_api/operator_subnet_login.go deleted file mode 100644 index 6147df88f..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_login.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// OperatorSubnetLoginHandlerFunc turns a function with the right signature into a operator subnet login handler -type OperatorSubnetLoginHandlerFunc func(OperatorSubnetLoginParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn OperatorSubnetLoginHandlerFunc) Handle(params OperatorSubnetLoginParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// OperatorSubnetLoginHandler interface for that can handle valid operator subnet login params -type OperatorSubnetLoginHandler interface { - Handle(OperatorSubnetLoginParams, *models.Principal) middleware.Responder -} - -// NewOperatorSubnetLogin creates a new http.Handler for the operator subnet login operation -func NewOperatorSubnetLogin(ctx *middleware.Context, handler OperatorSubnetLoginHandler) *OperatorSubnetLogin { - return &OperatorSubnetLogin{Context: ctx, Handler: handler} -} - -/* - OperatorSubnetLogin swagger:route POST /subnet/login OperatorAPI operatorSubnetLogin - -Login to subnet -*/ -type OperatorSubnetLogin struct { - Context *middleware.Context - Handler OperatorSubnetLoginHandler -} - -func (o *OperatorSubnetLogin) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewOperatorSubnetLoginParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/operator_subnet_login_m_f_a.go b/operatorapi/operations/operator_api/operator_subnet_login_m_f_a.go deleted file mode 100644 index 4b6d99dae..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_login_m_f_a.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// OperatorSubnetLoginMFAHandlerFunc turns a function with the right signature into a operator subnet login m f a handler -type OperatorSubnetLoginMFAHandlerFunc func(OperatorSubnetLoginMFAParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn OperatorSubnetLoginMFAHandlerFunc) Handle(params OperatorSubnetLoginMFAParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// OperatorSubnetLoginMFAHandler interface for that can handle valid operator subnet login m f a params -type OperatorSubnetLoginMFAHandler interface { - Handle(OperatorSubnetLoginMFAParams, *models.Principal) middleware.Responder -} - -// NewOperatorSubnetLoginMFA creates a new http.Handler for the operator subnet login m f a operation -func NewOperatorSubnetLoginMFA(ctx *middleware.Context, handler OperatorSubnetLoginMFAHandler) *OperatorSubnetLoginMFA { - return &OperatorSubnetLoginMFA{Context: ctx, Handler: handler} -} - -/* - OperatorSubnetLoginMFA swagger:route POST /subnet/login/mfa OperatorAPI operatorSubnetLoginMFA - -Login to subnet using mfa -*/ -type OperatorSubnetLoginMFA struct { - Context *middleware.Context - Handler OperatorSubnetLoginMFAHandler -} - -func (o *OperatorSubnetLoginMFA) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewOperatorSubnetLoginMFAParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/operator_subnet_login_m_f_a_parameters.go b/operatorapi/operations/operator_api/operator_subnet_login_m_f_a_parameters.go deleted file mode 100644 index c79b092a7..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_login_m_f_a_parameters.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewOperatorSubnetLoginMFAParams creates a new OperatorSubnetLoginMFAParams object -// -// There are no default values defined in the spec. -func NewOperatorSubnetLoginMFAParams() OperatorSubnetLoginMFAParams { - - return OperatorSubnetLoginMFAParams{} -} - -// OperatorSubnetLoginMFAParams contains all the bound params for the operator subnet login m f a operation -// typically these are obtained from a http.Request -// -// swagger:parameters OperatorSubnetLoginMFA -type OperatorSubnetLoginMFAParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.OperatorSubnetLoginMFARequest -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewOperatorSubnetLoginMFAParams() beforehand. -func (o *OperatorSubnetLoginMFAParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.OperatorSubnetLoginMFARequest - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/operator_api/operator_subnet_login_m_f_a_responses.go b/operatorapi/operations/operator_api/operator_subnet_login_m_f_a_responses.go deleted file mode 100644 index 22cd812e5..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_login_m_f_a_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// OperatorSubnetLoginMFAOKCode is the HTTP code returned for type OperatorSubnetLoginMFAOK -const OperatorSubnetLoginMFAOKCode int = 200 - -/* -OperatorSubnetLoginMFAOK A successful response. - -swagger:response operatorSubnetLoginMFAOK -*/ -type OperatorSubnetLoginMFAOK struct { - - /* - In: Body - */ - Payload *models.OperatorSubnetLoginResponse `json:"body,omitempty"` -} - -// NewOperatorSubnetLoginMFAOK creates OperatorSubnetLoginMFAOK with default headers values -func NewOperatorSubnetLoginMFAOK() *OperatorSubnetLoginMFAOK { - - return &OperatorSubnetLoginMFAOK{} -} - -// WithPayload adds the payload to the operator subnet login m f a o k response -func (o *OperatorSubnetLoginMFAOK) WithPayload(payload *models.OperatorSubnetLoginResponse) *OperatorSubnetLoginMFAOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the operator subnet login m f a o k response -func (o *OperatorSubnetLoginMFAOK) SetPayload(payload *models.OperatorSubnetLoginResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *OperatorSubnetLoginMFAOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -OperatorSubnetLoginMFADefault Generic error response. - -swagger:response operatorSubnetLoginMFADefault -*/ -type OperatorSubnetLoginMFADefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewOperatorSubnetLoginMFADefault creates OperatorSubnetLoginMFADefault with default headers values -func NewOperatorSubnetLoginMFADefault(code int) *OperatorSubnetLoginMFADefault { - if code <= 0 { - code = 500 - } - - return &OperatorSubnetLoginMFADefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the operator subnet login m f a default response -func (o *OperatorSubnetLoginMFADefault) WithStatusCode(code int) *OperatorSubnetLoginMFADefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the operator subnet login m f a default response -func (o *OperatorSubnetLoginMFADefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the operator subnet login m f a default response -func (o *OperatorSubnetLoginMFADefault) WithPayload(payload *models.Error) *OperatorSubnetLoginMFADefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the operator subnet login m f a default response -func (o *OperatorSubnetLoginMFADefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *OperatorSubnetLoginMFADefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/operator_subnet_login_m_f_a_urlbuilder.go b/operatorapi/operations/operator_api/operator_subnet_login_m_f_a_urlbuilder.go deleted file mode 100644 index dc52a70eb..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_login_m_f_a_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// OperatorSubnetLoginMFAURL generates an URL for the operator subnet login m f a operation -type OperatorSubnetLoginMFAURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *OperatorSubnetLoginMFAURL) WithBasePath(bp string) *OperatorSubnetLoginMFAURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *OperatorSubnetLoginMFAURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *OperatorSubnetLoginMFAURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/subnet/login/mfa" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *OperatorSubnetLoginMFAURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *OperatorSubnetLoginMFAURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *OperatorSubnetLoginMFAURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on OperatorSubnetLoginMFAURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on OperatorSubnetLoginMFAURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *OperatorSubnetLoginMFAURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/operator_subnet_login_parameters.go b/operatorapi/operations/operator_api/operator_subnet_login_parameters.go deleted file mode 100644 index 13bc64b98..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_login_parameters.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewOperatorSubnetLoginParams creates a new OperatorSubnetLoginParams object -// -// There are no default values defined in the spec. -func NewOperatorSubnetLoginParams() OperatorSubnetLoginParams { - - return OperatorSubnetLoginParams{} -} - -// OperatorSubnetLoginParams contains all the bound params for the operator subnet login operation -// typically these are obtained from a http.Request -// -// swagger:parameters OperatorSubnetLogin -type OperatorSubnetLoginParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.OperatorSubnetLoginRequest -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewOperatorSubnetLoginParams() beforehand. -func (o *OperatorSubnetLoginParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.OperatorSubnetLoginRequest - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/operator_api/operator_subnet_login_responses.go b/operatorapi/operations/operator_api/operator_subnet_login_responses.go deleted file mode 100644 index 392563a90..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_login_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// OperatorSubnetLoginOKCode is the HTTP code returned for type OperatorSubnetLoginOK -const OperatorSubnetLoginOKCode int = 200 - -/* -OperatorSubnetLoginOK A successful response. - -swagger:response operatorSubnetLoginOK -*/ -type OperatorSubnetLoginOK struct { - - /* - In: Body - */ - Payload *models.OperatorSubnetLoginResponse `json:"body,omitempty"` -} - -// NewOperatorSubnetLoginOK creates OperatorSubnetLoginOK with default headers values -func NewOperatorSubnetLoginOK() *OperatorSubnetLoginOK { - - return &OperatorSubnetLoginOK{} -} - -// WithPayload adds the payload to the operator subnet login o k response -func (o *OperatorSubnetLoginOK) WithPayload(payload *models.OperatorSubnetLoginResponse) *OperatorSubnetLoginOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the operator subnet login o k response -func (o *OperatorSubnetLoginOK) SetPayload(payload *models.OperatorSubnetLoginResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *OperatorSubnetLoginOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -OperatorSubnetLoginDefault Generic error response. - -swagger:response operatorSubnetLoginDefault -*/ -type OperatorSubnetLoginDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewOperatorSubnetLoginDefault creates OperatorSubnetLoginDefault with default headers values -func NewOperatorSubnetLoginDefault(code int) *OperatorSubnetLoginDefault { - if code <= 0 { - code = 500 - } - - return &OperatorSubnetLoginDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the operator subnet login default response -func (o *OperatorSubnetLoginDefault) WithStatusCode(code int) *OperatorSubnetLoginDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the operator subnet login default response -func (o *OperatorSubnetLoginDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the operator subnet login default response -func (o *OperatorSubnetLoginDefault) WithPayload(payload *models.Error) *OperatorSubnetLoginDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the operator subnet login default response -func (o *OperatorSubnetLoginDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *OperatorSubnetLoginDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/operator_subnet_login_urlbuilder.go b/operatorapi/operations/operator_api/operator_subnet_login_urlbuilder.go deleted file mode 100644 index 0c1b92bc8..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_login_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// OperatorSubnetLoginURL generates an URL for the operator subnet login operation -type OperatorSubnetLoginURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *OperatorSubnetLoginURL) WithBasePath(bp string) *OperatorSubnetLoginURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *OperatorSubnetLoginURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *OperatorSubnetLoginURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/subnet/login" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *OperatorSubnetLoginURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *OperatorSubnetLoginURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *OperatorSubnetLoginURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on OperatorSubnetLoginURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on OperatorSubnetLoginURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *OperatorSubnetLoginURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/operator_subnet_register_api_key.go b/operatorapi/operations/operator_api/operator_subnet_register_api_key.go deleted file mode 100644 index 27258b6d6..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_register_api_key.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// OperatorSubnetRegisterAPIKeyHandlerFunc turns a function with the right signature into a operator subnet register API key handler -type OperatorSubnetRegisterAPIKeyHandlerFunc func(OperatorSubnetRegisterAPIKeyParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn OperatorSubnetRegisterAPIKeyHandlerFunc) Handle(params OperatorSubnetRegisterAPIKeyParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// OperatorSubnetRegisterAPIKeyHandler interface for that can handle valid operator subnet register API key params -type OperatorSubnetRegisterAPIKeyHandler interface { - Handle(OperatorSubnetRegisterAPIKeyParams, *models.Principal) middleware.Responder -} - -// NewOperatorSubnetRegisterAPIKey creates a new http.Handler for the operator subnet register API key operation -func NewOperatorSubnetRegisterAPIKey(ctx *middleware.Context, handler OperatorSubnetRegisterAPIKeyHandler) *OperatorSubnetRegisterAPIKey { - return &OperatorSubnetRegisterAPIKey{Context: ctx, Handler: handler} -} - -/* - OperatorSubnetRegisterAPIKey swagger:route POST /subnet/apikey/register OperatorAPI operatorSubnetRegisterApiKey - -Register Operator with Subnet -*/ -type OperatorSubnetRegisterAPIKey struct { - Context *middleware.Context - Handler OperatorSubnetRegisterAPIKeyHandler -} - -func (o *OperatorSubnetRegisterAPIKey) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewOperatorSubnetRegisterAPIKeyParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/operator_subnet_register_api_key_parameters.go b/operatorapi/operations/operator_api/operator_subnet_register_api_key_parameters.go deleted file mode 100644 index 6421ba6ee..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_register_api_key_parameters.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewOperatorSubnetRegisterAPIKeyParams creates a new OperatorSubnetRegisterAPIKeyParams object -// -// There are no default values defined in the spec. -func NewOperatorSubnetRegisterAPIKeyParams() OperatorSubnetRegisterAPIKeyParams { - - return OperatorSubnetRegisterAPIKeyParams{} -} - -// OperatorSubnetRegisterAPIKeyParams contains all the bound params for the operator subnet register API key operation -// typically these are obtained from a http.Request -// -// swagger:parameters OperatorSubnetRegisterAPIKey -type OperatorSubnetRegisterAPIKeyParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.OperatorSubnetAPIKey -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewOperatorSubnetRegisterAPIKeyParams() beforehand. -func (o *OperatorSubnetRegisterAPIKeyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.OperatorSubnetAPIKey - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/operator_api/operator_subnet_register_api_key_responses.go b/operatorapi/operations/operator_api/operator_subnet_register_api_key_responses.go deleted file mode 100644 index 782311308..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_register_api_key_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// OperatorSubnetRegisterAPIKeyOKCode is the HTTP code returned for type OperatorSubnetRegisterAPIKeyOK -const OperatorSubnetRegisterAPIKeyOKCode int = 200 - -/* -OperatorSubnetRegisterAPIKeyOK A successful response. - -swagger:response operatorSubnetRegisterApiKeyOK -*/ -type OperatorSubnetRegisterAPIKeyOK struct { - - /* - In: Body - */ - Payload *models.OperatorSubnetRegisterAPIKeyResponse `json:"body,omitempty"` -} - -// NewOperatorSubnetRegisterAPIKeyOK creates OperatorSubnetRegisterAPIKeyOK with default headers values -func NewOperatorSubnetRegisterAPIKeyOK() *OperatorSubnetRegisterAPIKeyOK { - - return &OperatorSubnetRegisterAPIKeyOK{} -} - -// WithPayload adds the payload to the operator subnet register Api key o k response -func (o *OperatorSubnetRegisterAPIKeyOK) WithPayload(payload *models.OperatorSubnetRegisterAPIKeyResponse) *OperatorSubnetRegisterAPIKeyOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the operator subnet register Api key o k response -func (o *OperatorSubnetRegisterAPIKeyOK) SetPayload(payload *models.OperatorSubnetRegisterAPIKeyResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *OperatorSubnetRegisterAPIKeyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -OperatorSubnetRegisterAPIKeyDefault Generic error response. - -swagger:response operatorSubnetRegisterApiKeyDefault -*/ -type OperatorSubnetRegisterAPIKeyDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewOperatorSubnetRegisterAPIKeyDefault creates OperatorSubnetRegisterAPIKeyDefault with default headers values -func NewOperatorSubnetRegisterAPIKeyDefault(code int) *OperatorSubnetRegisterAPIKeyDefault { - if code <= 0 { - code = 500 - } - - return &OperatorSubnetRegisterAPIKeyDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the operator subnet register API key default response -func (o *OperatorSubnetRegisterAPIKeyDefault) WithStatusCode(code int) *OperatorSubnetRegisterAPIKeyDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the operator subnet register API key default response -func (o *OperatorSubnetRegisterAPIKeyDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the operator subnet register API key default response -func (o *OperatorSubnetRegisterAPIKeyDefault) WithPayload(payload *models.Error) *OperatorSubnetRegisterAPIKeyDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the operator subnet register API key default response -func (o *OperatorSubnetRegisterAPIKeyDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *OperatorSubnetRegisterAPIKeyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/operator_subnet_register_api_key_urlbuilder.go b/operatorapi/operations/operator_api/operator_subnet_register_api_key_urlbuilder.go deleted file mode 100644 index c2aba48b7..000000000 --- a/operatorapi/operations/operator_api/operator_subnet_register_api_key_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// OperatorSubnetRegisterAPIKeyURL generates an URL for the operator subnet register API key operation -type OperatorSubnetRegisterAPIKeyURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *OperatorSubnetRegisterAPIKeyURL) WithBasePath(bp string) *OperatorSubnetRegisterAPIKeyURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *OperatorSubnetRegisterAPIKeyURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *OperatorSubnetRegisterAPIKeyURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/subnet/apikey/register" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *OperatorSubnetRegisterAPIKeyURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *OperatorSubnetRegisterAPIKeyURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *OperatorSubnetRegisterAPIKeyURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on OperatorSubnetRegisterAPIKeyURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on OperatorSubnetRegisterAPIKeyURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *OperatorSubnetRegisterAPIKeyURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/post_m_p_integration.go b/operatorapi/operations/operator_api/post_m_p_integration.go deleted file mode 100644 index 868036daf..000000000 --- a/operatorapi/operations/operator_api/post_m_p_integration.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// PostMPIntegrationHandlerFunc turns a function with the right signature into a post m p integration handler -type PostMPIntegrationHandlerFunc func(PostMPIntegrationParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn PostMPIntegrationHandlerFunc) Handle(params PostMPIntegrationParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// PostMPIntegrationHandler interface for that can handle valid post m p integration params -type PostMPIntegrationHandler interface { - Handle(PostMPIntegrationParams, *models.Principal) middleware.Responder -} - -// NewPostMPIntegration creates a new http.Handler for the post m p integration operation -func NewPostMPIntegration(ctx *middleware.Context, handler PostMPIntegrationHandler) *PostMPIntegration { - return &PostMPIntegration{Context: ctx, Handler: handler} -} - -/* - PostMPIntegration swagger:route POST /mp-integration OperatorAPI postMPIntegration - -Set email to register for marketplace integration -*/ -type PostMPIntegration struct { - Context *middleware.Context - Handler PostMPIntegrationHandler -} - -func (o *PostMPIntegration) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewPostMPIntegrationParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/post_m_p_integration_parameters.go b/operatorapi/operations/operator_api/post_m_p_integration_parameters.go deleted file mode 100644 index 2bb311222..000000000 --- a/operatorapi/operations/operator_api/post_m_p_integration_parameters.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewPostMPIntegrationParams creates a new PostMPIntegrationParams object -// -// There are no default values defined in the spec. -func NewPostMPIntegrationParams() PostMPIntegrationParams { - - return PostMPIntegrationParams{} -} - -// PostMPIntegrationParams contains all the bound params for the post m p integration operation -// typically these are obtained from a http.Request -// -// swagger:parameters PostMPIntegration -type PostMPIntegrationParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.MpIntegration -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewPostMPIntegrationParams() beforehand. -func (o *PostMPIntegrationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.MpIntegration - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/operator_api/post_m_p_integration_responses.go b/operatorapi/operations/operator_api/post_m_p_integration_responses.go deleted file mode 100644 index 956b10ad0..000000000 --- a/operatorapi/operations/operator_api/post_m_p_integration_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// PostMPIntegrationCreatedCode is the HTTP code returned for type PostMPIntegrationCreated -const PostMPIntegrationCreatedCode int = 201 - -/* -PostMPIntegrationCreated A successful response. - -swagger:response postMPIntegrationCreated -*/ -type PostMPIntegrationCreated struct { -} - -// NewPostMPIntegrationCreated creates PostMPIntegrationCreated with default headers values -func NewPostMPIntegrationCreated() *PostMPIntegrationCreated { - - return &PostMPIntegrationCreated{} -} - -// WriteResponse to the client -func (o *PostMPIntegrationCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -/* -PostMPIntegrationDefault Generic error response. - -swagger:response postMPIntegrationDefault -*/ -type PostMPIntegrationDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewPostMPIntegrationDefault creates PostMPIntegrationDefault with default headers values -func NewPostMPIntegrationDefault(code int) *PostMPIntegrationDefault { - if code <= 0 { - code = 500 - } - - return &PostMPIntegrationDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the post m p integration default response -func (o *PostMPIntegrationDefault) WithStatusCode(code int) *PostMPIntegrationDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the post m p integration default response -func (o *PostMPIntegrationDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the post m p integration default response -func (o *PostMPIntegrationDefault) WithPayload(payload *models.Error) *PostMPIntegrationDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the post m p integration default response -func (o *PostMPIntegrationDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PostMPIntegrationDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/post_m_p_integration_urlbuilder.go b/operatorapi/operations/operator_api/post_m_p_integration_urlbuilder.go deleted file mode 100644 index d5499146e..000000000 --- a/operatorapi/operations/operator_api/post_m_p_integration_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// PostMPIntegrationURL generates an URL for the post m p integration operation -type PostMPIntegrationURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *PostMPIntegrationURL) WithBasePath(bp string) *PostMPIntegrationURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *PostMPIntegrationURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *PostMPIntegrationURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/mp-integration" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *PostMPIntegrationURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *PostMPIntegrationURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *PostMPIntegrationURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on PostMPIntegrationURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on PostMPIntegrationURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *PostMPIntegrationURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/put_tenant_y_a_m_l.go b/operatorapi/operations/operator_api/put_tenant_y_a_m_l.go deleted file mode 100644 index 442540434..000000000 --- a/operatorapi/operations/operator_api/put_tenant_y_a_m_l.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// PutTenantYAMLHandlerFunc turns a function with the right signature into a put tenant y a m l handler -type PutTenantYAMLHandlerFunc func(PutTenantYAMLParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn PutTenantYAMLHandlerFunc) Handle(params PutTenantYAMLParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// PutTenantYAMLHandler interface for that can handle valid put tenant y a m l params -type PutTenantYAMLHandler interface { - Handle(PutTenantYAMLParams, *models.Principal) middleware.Responder -} - -// NewPutTenantYAML creates a new http.Handler for the put tenant y a m l operation -func NewPutTenantYAML(ctx *middleware.Context, handler PutTenantYAMLHandler) *PutTenantYAML { - return &PutTenantYAML{Context: ctx, Handler: handler} -} - -/* - PutTenantYAML swagger:route PUT /namespaces/{namespace}/tenants/{tenant}/yaml OperatorAPI putTenantYAML - -Put the Tenant YAML -*/ -type PutTenantYAML struct { - Context *middleware.Context - Handler PutTenantYAMLHandler -} - -func (o *PutTenantYAML) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewPutTenantYAMLParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/put_tenant_y_a_m_l_parameters.go b/operatorapi/operations/operator_api/put_tenant_y_a_m_l_parameters.go deleted file mode 100644 index 9d408ccc5..000000000 --- a/operatorapi/operations/operator_api/put_tenant_y_a_m_l_parameters.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewPutTenantYAMLParams creates a new PutTenantYAMLParams object -// -// There are no default values defined in the spec. -func NewPutTenantYAMLParams() PutTenantYAMLParams { - - return PutTenantYAMLParams{} -} - -// PutTenantYAMLParams contains all the bound params for the put tenant y a m l operation -// typically these are obtained from a http.Request -// -// swagger:parameters PutTenantYAML -type PutTenantYAMLParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.TenantYAML - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewPutTenantYAMLParams() beforehand. -func (o *PutTenantYAMLParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TenantYAML - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *PutTenantYAMLParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *PutTenantYAMLParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/put_tenant_y_a_m_l_responses.go b/operatorapi/operations/operator_api/put_tenant_y_a_m_l_responses.go deleted file mode 100644 index cda64dee5..000000000 --- a/operatorapi/operations/operator_api/put_tenant_y_a_m_l_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// PutTenantYAMLCreatedCode is the HTTP code returned for type PutTenantYAMLCreated -const PutTenantYAMLCreatedCode int = 201 - -/* -PutTenantYAMLCreated A successful response. - -swagger:response putTenantYAMLCreated -*/ -type PutTenantYAMLCreated struct { -} - -// NewPutTenantYAMLCreated creates PutTenantYAMLCreated with default headers values -func NewPutTenantYAMLCreated() *PutTenantYAMLCreated { - - return &PutTenantYAMLCreated{} -} - -// WriteResponse to the client -func (o *PutTenantYAMLCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -/* -PutTenantYAMLDefault Generic error response. - -swagger:response putTenantYAMLDefault -*/ -type PutTenantYAMLDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewPutTenantYAMLDefault creates PutTenantYAMLDefault with default headers values -func NewPutTenantYAMLDefault(code int) *PutTenantYAMLDefault { - if code <= 0 { - code = 500 - } - - return &PutTenantYAMLDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the put tenant y a m l default response -func (o *PutTenantYAMLDefault) WithStatusCode(code int) *PutTenantYAMLDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the put tenant y a m l default response -func (o *PutTenantYAMLDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the put tenant y a m l default response -func (o *PutTenantYAMLDefault) WithPayload(payload *models.Error) *PutTenantYAMLDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the put tenant y a m l default response -func (o *PutTenantYAMLDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PutTenantYAMLDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/put_tenant_y_a_m_l_urlbuilder.go b/operatorapi/operations/operator_api/put_tenant_y_a_m_l_urlbuilder.go deleted file mode 100644 index 7bcea89ba..000000000 --- a/operatorapi/operations/operator_api/put_tenant_y_a_m_l_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// PutTenantYAMLURL generates an URL for the put tenant y a m l operation -type PutTenantYAMLURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *PutTenantYAMLURL) WithBasePath(bp string) *PutTenantYAMLURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *PutTenantYAMLURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *PutTenantYAMLURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/yaml" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on PutTenantYAMLURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on PutTenantYAMLURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *PutTenantYAMLURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *PutTenantYAMLURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *PutTenantYAMLURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on PutTenantYAMLURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on PutTenantYAMLURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *PutTenantYAMLURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/set_tenant_administrators.go b/operatorapi/operations/operator_api/set_tenant_administrators.go deleted file mode 100644 index 20c3dd923..000000000 --- a/operatorapi/operations/operator_api/set_tenant_administrators.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// SetTenantAdministratorsHandlerFunc turns a function with the right signature into a set tenant administrators handler -type SetTenantAdministratorsHandlerFunc func(SetTenantAdministratorsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn SetTenantAdministratorsHandlerFunc) Handle(params SetTenantAdministratorsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// SetTenantAdministratorsHandler interface for that can handle valid set tenant administrators params -type SetTenantAdministratorsHandler interface { - Handle(SetTenantAdministratorsParams, *models.Principal) middleware.Responder -} - -// NewSetTenantAdministrators creates a new http.Handler for the set tenant administrators operation -func NewSetTenantAdministrators(ctx *middleware.Context, handler SetTenantAdministratorsHandler) *SetTenantAdministrators { - return &SetTenantAdministrators{Context: ctx, Handler: handler} -} - -/* - SetTenantAdministrators swagger:route POST /namespaces/{namespace}/tenants/{tenant}/set-administrators OperatorAPI setTenantAdministrators - -Set the consoleAdmin policy to the specified users and groups -*/ -type SetTenantAdministrators struct { - Context *middleware.Context - Handler SetTenantAdministratorsHandler -} - -func (o *SetTenantAdministrators) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewSetTenantAdministratorsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/set_tenant_administrators_parameters.go b/operatorapi/operations/operator_api/set_tenant_administrators_parameters.go deleted file mode 100644 index c36d72c26..000000000 --- a/operatorapi/operations/operator_api/set_tenant_administrators_parameters.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewSetTenantAdministratorsParams creates a new SetTenantAdministratorsParams object -// -// There are no default values defined in the spec. -func NewSetTenantAdministratorsParams() SetTenantAdministratorsParams { - - return SetTenantAdministratorsParams{} -} - -// SetTenantAdministratorsParams contains all the bound params for the set tenant administrators operation -// typically these are obtained from a http.Request -// -// swagger:parameters SetTenantAdministrators -type SetTenantAdministratorsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.SetAdministratorsRequest - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewSetTenantAdministratorsParams() beforehand. -func (o *SetTenantAdministratorsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.SetAdministratorsRequest - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *SetTenantAdministratorsParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *SetTenantAdministratorsParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/set_tenant_administrators_responses.go b/operatorapi/operations/operator_api/set_tenant_administrators_responses.go deleted file mode 100644 index 0a51cd9b1..000000000 --- a/operatorapi/operations/operator_api/set_tenant_administrators_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// SetTenantAdministratorsNoContentCode is the HTTP code returned for type SetTenantAdministratorsNoContent -const SetTenantAdministratorsNoContentCode int = 204 - -/* -SetTenantAdministratorsNoContent A successful response. - -swagger:response setTenantAdministratorsNoContent -*/ -type SetTenantAdministratorsNoContent struct { -} - -// NewSetTenantAdministratorsNoContent creates SetTenantAdministratorsNoContent with default headers values -func NewSetTenantAdministratorsNoContent() *SetTenantAdministratorsNoContent { - - return &SetTenantAdministratorsNoContent{} -} - -// WriteResponse to the client -func (o *SetTenantAdministratorsNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -SetTenantAdministratorsDefault Generic error response. - -swagger:response setTenantAdministratorsDefault -*/ -type SetTenantAdministratorsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewSetTenantAdministratorsDefault creates SetTenantAdministratorsDefault with default headers values -func NewSetTenantAdministratorsDefault(code int) *SetTenantAdministratorsDefault { - if code <= 0 { - code = 500 - } - - return &SetTenantAdministratorsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the set tenant administrators default response -func (o *SetTenantAdministratorsDefault) WithStatusCode(code int) *SetTenantAdministratorsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the set tenant administrators default response -func (o *SetTenantAdministratorsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the set tenant administrators default response -func (o *SetTenantAdministratorsDefault) WithPayload(payload *models.Error) *SetTenantAdministratorsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the set tenant administrators default response -func (o *SetTenantAdministratorsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SetTenantAdministratorsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/set_tenant_administrators_urlbuilder.go b/operatorapi/operations/operator_api/set_tenant_administrators_urlbuilder.go deleted file mode 100644 index f1d068012..000000000 --- a/operatorapi/operations/operator_api/set_tenant_administrators_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// SetTenantAdministratorsURL generates an URL for the set tenant administrators operation -type SetTenantAdministratorsURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SetTenantAdministratorsURL) WithBasePath(bp string) *SetTenantAdministratorsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SetTenantAdministratorsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *SetTenantAdministratorsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/set-administrators" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on SetTenantAdministratorsURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on SetTenantAdministratorsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *SetTenantAdministratorsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *SetTenantAdministratorsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *SetTenantAdministratorsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on SetTenantAdministratorsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on SetTenantAdministratorsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *SetTenantAdministratorsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/set_tenant_logs.go b/operatorapi/operations/operator_api/set_tenant_logs.go deleted file mode 100644 index dbeab2cd5..000000000 --- a/operatorapi/operations/operator_api/set_tenant_logs.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// SetTenantLogsHandlerFunc turns a function with the right signature into a set tenant logs handler -type SetTenantLogsHandlerFunc func(SetTenantLogsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn SetTenantLogsHandlerFunc) Handle(params SetTenantLogsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// SetTenantLogsHandler interface for that can handle valid set tenant logs params -type SetTenantLogsHandler interface { - Handle(SetTenantLogsParams, *models.Principal) middleware.Responder -} - -// NewSetTenantLogs creates a new http.Handler for the set tenant logs operation -func NewSetTenantLogs(ctx *middleware.Context, handler SetTenantLogsHandler) *SetTenantLogs { - return &SetTenantLogs{Context: ctx, Handler: handler} -} - -/* - SetTenantLogs swagger:route PUT /namespaces/{namespace}/tenants/{tenant}/log OperatorAPI setTenantLogs - -Set Tenant Logs -*/ -type SetTenantLogs struct { - Context *middleware.Context - Handler SetTenantLogsHandler -} - -func (o *SetTenantLogs) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewSetTenantLogsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/set_tenant_logs_parameters.go b/operatorapi/operations/operator_api/set_tenant_logs_parameters.go deleted file mode 100644 index 69498e4b9..000000000 --- a/operatorapi/operations/operator_api/set_tenant_logs_parameters.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewSetTenantLogsParams creates a new SetTenantLogsParams object -// -// There are no default values defined in the spec. -func NewSetTenantLogsParams() SetTenantLogsParams { - - return SetTenantLogsParams{} -} - -// SetTenantLogsParams contains all the bound params for the set tenant logs operation -// typically these are obtained from a http.Request -// -// swagger:parameters SetTenantLogs -type SetTenantLogsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.TenantLogs - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewSetTenantLogsParams() beforehand. -func (o *SetTenantLogsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TenantLogs - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *SetTenantLogsParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *SetTenantLogsParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/set_tenant_logs_responses.go b/operatorapi/operations/operator_api/set_tenant_logs_responses.go deleted file mode 100644 index e2f8fada1..000000000 --- a/operatorapi/operations/operator_api/set_tenant_logs_responses.go +++ /dev/null @@ -1,133 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// SetTenantLogsOKCode is the HTTP code returned for type SetTenantLogsOK -const SetTenantLogsOKCode int = 200 - -/* -SetTenantLogsOK A successful response. - -swagger:response setTenantLogsOK -*/ -type SetTenantLogsOK struct { - - /* - In: Body - */ - Payload bool `json:"body,omitempty"` -} - -// NewSetTenantLogsOK creates SetTenantLogsOK with default headers values -func NewSetTenantLogsOK() *SetTenantLogsOK { - - return &SetTenantLogsOK{} -} - -// WithPayload adds the payload to the set tenant logs o k response -func (o *SetTenantLogsOK) WithPayload(payload bool) *SetTenantLogsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the set tenant logs o k response -func (o *SetTenantLogsOK) SetPayload(payload bool) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SetTenantLogsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -SetTenantLogsDefault Generic error response. - -swagger:response setTenantLogsDefault -*/ -type SetTenantLogsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewSetTenantLogsDefault creates SetTenantLogsDefault with default headers values -func NewSetTenantLogsDefault(code int) *SetTenantLogsDefault { - if code <= 0 { - code = 500 - } - - return &SetTenantLogsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the set tenant logs default response -func (o *SetTenantLogsDefault) WithStatusCode(code int) *SetTenantLogsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the set tenant logs default response -func (o *SetTenantLogsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the set tenant logs default response -func (o *SetTenantLogsDefault) WithPayload(payload *models.Error) *SetTenantLogsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the set tenant logs default response -func (o *SetTenantLogsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SetTenantLogsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/set_tenant_logs_urlbuilder.go b/operatorapi/operations/operator_api/set_tenant_logs_urlbuilder.go deleted file mode 100644 index f4f4c5fb0..000000000 --- a/operatorapi/operations/operator_api/set_tenant_logs_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// SetTenantLogsURL generates an URL for the set tenant logs operation -type SetTenantLogsURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SetTenantLogsURL) WithBasePath(bp string) *SetTenantLogsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SetTenantLogsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *SetTenantLogsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/log" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on SetTenantLogsURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on SetTenantLogsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *SetTenantLogsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *SetTenantLogsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *SetTenantLogsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on SetTenantLogsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on SetTenantLogsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *SetTenantLogsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/set_tenant_monitoring.go b/operatorapi/operations/operator_api/set_tenant_monitoring.go deleted file mode 100644 index e5f6ad49b..000000000 --- a/operatorapi/operations/operator_api/set_tenant_monitoring.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// SetTenantMonitoringHandlerFunc turns a function with the right signature into a set tenant monitoring handler -type SetTenantMonitoringHandlerFunc func(SetTenantMonitoringParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn SetTenantMonitoringHandlerFunc) Handle(params SetTenantMonitoringParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// SetTenantMonitoringHandler interface for that can handle valid set tenant monitoring params -type SetTenantMonitoringHandler interface { - Handle(SetTenantMonitoringParams, *models.Principal) middleware.Responder -} - -// NewSetTenantMonitoring creates a new http.Handler for the set tenant monitoring operation -func NewSetTenantMonitoring(ctx *middleware.Context, handler SetTenantMonitoringHandler) *SetTenantMonitoring { - return &SetTenantMonitoring{Context: ctx, Handler: handler} -} - -/* - SetTenantMonitoring swagger:route PUT /namespaces/{namespace}/tenants/{tenant}/monitoring OperatorAPI setTenantMonitoring - -Set Prometheus monitoring fields for tenant -*/ -type SetTenantMonitoring struct { - Context *middleware.Context - Handler SetTenantMonitoringHandler -} - -func (o *SetTenantMonitoring) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewSetTenantMonitoringParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/set_tenant_monitoring_parameters.go b/operatorapi/operations/operator_api/set_tenant_monitoring_parameters.go deleted file mode 100644 index 56fb8bffe..000000000 --- a/operatorapi/operations/operator_api/set_tenant_monitoring_parameters.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewSetTenantMonitoringParams creates a new SetTenantMonitoringParams object -// -// There are no default values defined in the spec. -func NewSetTenantMonitoringParams() SetTenantMonitoringParams { - - return SetTenantMonitoringParams{} -} - -// SetTenantMonitoringParams contains all the bound params for the set tenant monitoring operation -// typically these are obtained from a http.Request -// -// swagger:parameters SetTenantMonitoring -type SetTenantMonitoringParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.TenantMonitoringInfo - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewSetTenantMonitoringParams() beforehand. -func (o *SetTenantMonitoringParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TenantMonitoringInfo - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *SetTenantMonitoringParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *SetTenantMonitoringParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/set_tenant_monitoring_responses.go b/operatorapi/operations/operator_api/set_tenant_monitoring_responses.go deleted file mode 100644 index 764263051..000000000 --- a/operatorapi/operations/operator_api/set_tenant_monitoring_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// SetTenantMonitoringCreatedCode is the HTTP code returned for type SetTenantMonitoringCreated -const SetTenantMonitoringCreatedCode int = 201 - -/* -SetTenantMonitoringCreated A successful response. - -swagger:response setTenantMonitoringCreated -*/ -type SetTenantMonitoringCreated struct { -} - -// NewSetTenantMonitoringCreated creates SetTenantMonitoringCreated with default headers values -func NewSetTenantMonitoringCreated() *SetTenantMonitoringCreated { - - return &SetTenantMonitoringCreated{} -} - -// WriteResponse to the client -func (o *SetTenantMonitoringCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -/* -SetTenantMonitoringDefault Generic error response. - -swagger:response setTenantMonitoringDefault -*/ -type SetTenantMonitoringDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewSetTenantMonitoringDefault creates SetTenantMonitoringDefault with default headers values -func NewSetTenantMonitoringDefault(code int) *SetTenantMonitoringDefault { - if code <= 0 { - code = 500 - } - - return &SetTenantMonitoringDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the set tenant monitoring default response -func (o *SetTenantMonitoringDefault) WithStatusCode(code int) *SetTenantMonitoringDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the set tenant monitoring default response -func (o *SetTenantMonitoringDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the set tenant monitoring default response -func (o *SetTenantMonitoringDefault) WithPayload(payload *models.Error) *SetTenantMonitoringDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the set tenant monitoring default response -func (o *SetTenantMonitoringDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SetTenantMonitoringDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/set_tenant_monitoring_urlbuilder.go b/operatorapi/operations/operator_api/set_tenant_monitoring_urlbuilder.go deleted file mode 100644 index cb395def9..000000000 --- a/operatorapi/operations/operator_api/set_tenant_monitoring_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// SetTenantMonitoringURL generates an URL for the set tenant monitoring operation -type SetTenantMonitoringURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SetTenantMonitoringURL) WithBasePath(bp string) *SetTenantMonitoringURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SetTenantMonitoringURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *SetTenantMonitoringURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/monitoring" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on SetTenantMonitoringURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on SetTenantMonitoringURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *SetTenantMonitoringURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *SetTenantMonitoringURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *SetTenantMonitoringURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on SetTenantMonitoringURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on SetTenantMonitoringURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *SetTenantMonitoringURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/subscription_activate.go b/operatorapi/operations/operator_api/subscription_activate.go deleted file mode 100644 index 8634fe1ff..000000000 --- a/operatorapi/operations/operator_api/subscription_activate.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// SubscriptionActivateHandlerFunc turns a function with the right signature into a subscription activate handler -type SubscriptionActivateHandlerFunc func(SubscriptionActivateParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn SubscriptionActivateHandlerFunc) Handle(params SubscriptionActivateParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// SubscriptionActivateHandler interface for that can handle valid subscription activate params -type SubscriptionActivateHandler interface { - Handle(SubscriptionActivateParams, *models.Principal) middleware.Responder -} - -// NewSubscriptionActivate creates a new http.Handler for the subscription activate operation -func NewSubscriptionActivate(ctx *middleware.Context, handler SubscriptionActivateHandler) *SubscriptionActivate { - return &SubscriptionActivate{Context: ctx, Handler: handler} -} - -/* - SubscriptionActivate swagger:route POST /subscription/namespaces/{namespace}/tenants/{tenant}/activate OperatorAPI subscriptionActivate - -Activate a particular tenant using the existing subscription license -*/ -type SubscriptionActivate struct { - Context *middleware.Context - Handler SubscriptionActivateHandler -} - -func (o *SubscriptionActivate) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewSubscriptionActivateParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/subscription_activate_parameters.go b/operatorapi/operations/operator_api/subscription_activate_parameters.go deleted file mode 100644 index 1fa9565ed..000000000 --- a/operatorapi/operations/operator_api/subscription_activate_parameters.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewSubscriptionActivateParams creates a new SubscriptionActivateParams object -// -// There are no default values defined in the spec. -func NewSubscriptionActivateParams() SubscriptionActivateParams { - - return SubscriptionActivateParams{} -} - -// SubscriptionActivateParams contains all the bound params for the subscription activate operation -// typically these are obtained from a http.Request -// -// swagger:parameters SubscriptionActivate -type SubscriptionActivateParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewSubscriptionActivateParams() beforehand. -func (o *SubscriptionActivateParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *SubscriptionActivateParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *SubscriptionActivateParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/subscription_activate_responses.go b/operatorapi/operations/operator_api/subscription_activate_responses.go deleted file mode 100644 index e06255596..000000000 --- a/operatorapi/operations/operator_api/subscription_activate_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// SubscriptionActivateNoContentCode is the HTTP code returned for type SubscriptionActivateNoContent -const SubscriptionActivateNoContentCode int = 204 - -/* -SubscriptionActivateNoContent A successful response. - -swagger:response subscriptionActivateNoContent -*/ -type SubscriptionActivateNoContent struct { -} - -// NewSubscriptionActivateNoContent creates SubscriptionActivateNoContent with default headers values -func NewSubscriptionActivateNoContent() *SubscriptionActivateNoContent { - - return &SubscriptionActivateNoContent{} -} - -// WriteResponse to the client -func (o *SubscriptionActivateNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -SubscriptionActivateDefault Generic error response. - -swagger:response subscriptionActivateDefault -*/ -type SubscriptionActivateDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewSubscriptionActivateDefault creates SubscriptionActivateDefault with default headers values -func NewSubscriptionActivateDefault(code int) *SubscriptionActivateDefault { - if code <= 0 { - code = 500 - } - - return &SubscriptionActivateDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the subscription activate default response -func (o *SubscriptionActivateDefault) WithStatusCode(code int) *SubscriptionActivateDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the subscription activate default response -func (o *SubscriptionActivateDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the subscription activate default response -func (o *SubscriptionActivateDefault) WithPayload(payload *models.Error) *SubscriptionActivateDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the subscription activate default response -func (o *SubscriptionActivateDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SubscriptionActivateDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/subscription_activate_urlbuilder.go b/operatorapi/operations/operator_api/subscription_activate_urlbuilder.go deleted file mode 100644 index 2ce3323a1..000000000 --- a/operatorapi/operations/operator_api/subscription_activate_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// SubscriptionActivateURL generates an URL for the subscription activate operation -type SubscriptionActivateURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SubscriptionActivateURL) WithBasePath(bp string) *SubscriptionActivateURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SubscriptionActivateURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *SubscriptionActivateURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/subscription/namespaces/{namespace}/tenants/{tenant}/activate" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on SubscriptionActivateURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on SubscriptionActivateURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *SubscriptionActivateURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *SubscriptionActivateURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *SubscriptionActivateURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on SubscriptionActivateURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on SubscriptionActivateURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *SubscriptionActivateURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/subscription_info.go b/operatorapi/operations/operator_api/subscription_info.go deleted file mode 100644 index 0bd5e398d..000000000 --- a/operatorapi/operations/operator_api/subscription_info.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// SubscriptionInfoHandlerFunc turns a function with the right signature into a subscription info handler -type SubscriptionInfoHandlerFunc func(SubscriptionInfoParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn SubscriptionInfoHandlerFunc) Handle(params SubscriptionInfoParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// SubscriptionInfoHandler interface for that can handle valid subscription info params -type SubscriptionInfoHandler interface { - Handle(SubscriptionInfoParams, *models.Principal) middleware.Responder -} - -// NewSubscriptionInfo creates a new http.Handler for the subscription info operation -func NewSubscriptionInfo(ctx *middleware.Context, handler SubscriptionInfoHandler) *SubscriptionInfo { - return &SubscriptionInfo{Context: ctx, Handler: handler} -} - -/* - SubscriptionInfo swagger:route GET /subscription/info OperatorAPI subscriptionInfo - -Subscription info -*/ -type SubscriptionInfo struct { - Context *middleware.Context - Handler SubscriptionInfoHandler -} - -func (o *SubscriptionInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewSubscriptionInfoParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/subscription_info_parameters.go b/operatorapi/operations/operator_api/subscription_info_parameters.go deleted file mode 100644 index 3d102ebcd..000000000 --- a/operatorapi/operations/operator_api/subscription_info_parameters.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewSubscriptionInfoParams creates a new SubscriptionInfoParams object -// -// There are no default values defined in the spec. -func NewSubscriptionInfoParams() SubscriptionInfoParams { - - return SubscriptionInfoParams{} -} - -// SubscriptionInfoParams contains all the bound params for the subscription info operation -// typically these are obtained from a http.Request -// -// swagger:parameters SubscriptionInfo -type SubscriptionInfoParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewSubscriptionInfoParams() beforehand. -func (o *SubscriptionInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/operator_api/subscription_info_responses.go b/operatorapi/operations/operator_api/subscription_info_responses.go deleted file mode 100644 index 896b15854..000000000 --- a/operatorapi/operations/operator_api/subscription_info_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// SubscriptionInfoOKCode is the HTTP code returned for type SubscriptionInfoOK -const SubscriptionInfoOKCode int = 200 - -/* -SubscriptionInfoOK A successful response. - -swagger:response subscriptionInfoOK -*/ -type SubscriptionInfoOK struct { - - /* - In: Body - */ - Payload *models.License `json:"body,omitempty"` -} - -// NewSubscriptionInfoOK creates SubscriptionInfoOK with default headers values -func NewSubscriptionInfoOK() *SubscriptionInfoOK { - - return &SubscriptionInfoOK{} -} - -// WithPayload adds the payload to the subscription info o k response -func (o *SubscriptionInfoOK) WithPayload(payload *models.License) *SubscriptionInfoOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the subscription info o k response -func (o *SubscriptionInfoOK) SetPayload(payload *models.License) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SubscriptionInfoOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -SubscriptionInfoDefault Generic error response. - -swagger:response subscriptionInfoDefault -*/ -type SubscriptionInfoDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewSubscriptionInfoDefault creates SubscriptionInfoDefault with default headers values -func NewSubscriptionInfoDefault(code int) *SubscriptionInfoDefault { - if code <= 0 { - code = 500 - } - - return &SubscriptionInfoDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the subscription info default response -func (o *SubscriptionInfoDefault) WithStatusCode(code int) *SubscriptionInfoDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the subscription info default response -func (o *SubscriptionInfoDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the subscription info default response -func (o *SubscriptionInfoDefault) WithPayload(payload *models.Error) *SubscriptionInfoDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the subscription info default response -func (o *SubscriptionInfoDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SubscriptionInfoDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/subscription_info_urlbuilder.go b/operatorapi/operations/operator_api/subscription_info_urlbuilder.go deleted file mode 100644 index ee8b93727..000000000 --- a/operatorapi/operations/operator_api/subscription_info_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// SubscriptionInfoURL generates an URL for the subscription info operation -type SubscriptionInfoURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SubscriptionInfoURL) WithBasePath(bp string) *SubscriptionInfoURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SubscriptionInfoURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *SubscriptionInfoURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/subscription/info" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *SubscriptionInfoURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *SubscriptionInfoURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *SubscriptionInfoURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on SubscriptionInfoURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on SubscriptionInfoURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *SubscriptionInfoURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/subscription_refresh.go b/operatorapi/operations/operator_api/subscription_refresh.go deleted file mode 100644 index caa55b1d8..000000000 --- a/operatorapi/operations/operator_api/subscription_refresh.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// SubscriptionRefreshHandlerFunc turns a function with the right signature into a subscription refresh handler -type SubscriptionRefreshHandlerFunc func(SubscriptionRefreshParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn SubscriptionRefreshHandlerFunc) Handle(params SubscriptionRefreshParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// SubscriptionRefreshHandler interface for that can handle valid subscription refresh params -type SubscriptionRefreshHandler interface { - Handle(SubscriptionRefreshParams, *models.Principal) middleware.Responder -} - -// NewSubscriptionRefresh creates a new http.Handler for the subscription refresh operation -func NewSubscriptionRefresh(ctx *middleware.Context, handler SubscriptionRefreshHandler) *SubscriptionRefresh { - return &SubscriptionRefresh{Context: ctx, Handler: handler} -} - -/* - SubscriptionRefresh swagger:route POST /subscription/refresh OperatorAPI subscriptionRefresh - -Refresh existing subscription license -*/ -type SubscriptionRefresh struct { - Context *middleware.Context - Handler SubscriptionRefreshHandler -} - -func (o *SubscriptionRefresh) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewSubscriptionRefreshParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/subscription_refresh_parameters.go b/operatorapi/operations/operator_api/subscription_refresh_parameters.go deleted file mode 100644 index 0e1a52de1..000000000 --- a/operatorapi/operations/operator_api/subscription_refresh_parameters.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewSubscriptionRefreshParams creates a new SubscriptionRefreshParams object -// -// There are no default values defined in the spec. -func NewSubscriptionRefreshParams() SubscriptionRefreshParams { - - return SubscriptionRefreshParams{} -} - -// SubscriptionRefreshParams contains all the bound params for the subscription refresh operation -// typically these are obtained from a http.Request -// -// swagger:parameters SubscriptionRefresh -type SubscriptionRefreshParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewSubscriptionRefreshParams() beforehand. -func (o *SubscriptionRefreshParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/operator_api/subscription_refresh_responses.go b/operatorapi/operations/operator_api/subscription_refresh_responses.go deleted file mode 100644 index 5b1130c1f..000000000 --- a/operatorapi/operations/operator_api/subscription_refresh_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// SubscriptionRefreshOKCode is the HTTP code returned for type SubscriptionRefreshOK -const SubscriptionRefreshOKCode int = 200 - -/* -SubscriptionRefreshOK A successful response. - -swagger:response subscriptionRefreshOK -*/ -type SubscriptionRefreshOK struct { - - /* - In: Body - */ - Payload *models.License `json:"body,omitempty"` -} - -// NewSubscriptionRefreshOK creates SubscriptionRefreshOK with default headers values -func NewSubscriptionRefreshOK() *SubscriptionRefreshOK { - - return &SubscriptionRefreshOK{} -} - -// WithPayload adds the payload to the subscription refresh o k response -func (o *SubscriptionRefreshOK) WithPayload(payload *models.License) *SubscriptionRefreshOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the subscription refresh o k response -func (o *SubscriptionRefreshOK) SetPayload(payload *models.License) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SubscriptionRefreshOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -SubscriptionRefreshDefault Generic error response. - -swagger:response subscriptionRefreshDefault -*/ -type SubscriptionRefreshDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewSubscriptionRefreshDefault creates SubscriptionRefreshDefault with default headers values -func NewSubscriptionRefreshDefault(code int) *SubscriptionRefreshDefault { - if code <= 0 { - code = 500 - } - - return &SubscriptionRefreshDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the subscription refresh default response -func (o *SubscriptionRefreshDefault) WithStatusCode(code int) *SubscriptionRefreshDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the subscription refresh default response -func (o *SubscriptionRefreshDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the subscription refresh default response -func (o *SubscriptionRefreshDefault) WithPayload(payload *models.Error) *SubscriptionRefreshDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the subscription refresh default response -func (o *SubscriptionRefreshDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SubscriptionRefreshDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/subscription_refresh_urlbuilder.go b/operatorapi/operations/operator_api/subscription_refresh_urlbuilder.go deleted file mode 100644 index f4af7539b..000000000 --- a/operatorapi/operations/operator_api/subscription_refresh_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// SubscriptionRefreshURL generates an URL for the subscription refresh operation -type SubscriptionRefreshURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SubscriptionRefreshURL) WithBasePath(bp string) *SubscriptionRefreshURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SubscriptionRefreshURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *SubscriptionRefreshURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/subscription/refresh" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *SubscriptionRefreshURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *SubscriptionRefreshURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *SubscriptionRefreshURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on SubscriptionRefreshURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on SubscriptionRefreshURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *SubscriptionRefreshURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/subscription_validate.go b/operatorapi/operations/operator_api/subscription_validate.go deleted file mode 100644 index 9c75c0b32..000000000 --- a/operatorapi/operations/operator_api/subscription_validate.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// SubscriptionValidateHandlerFunc turns a function with the right signature into a subscription validate handler -type SubscriptionValidateHandlerFunc func(SubscriptionValidateParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn SubscriptionValidateHandlerFunc) Handle(params SubscriptionValidateParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// SubscriptionValidateHandler interface for that can handle valid subscription validate params -type SubscriptionValidateHandler interface { - Handle(SubscriptionValidateParams, *models.Principal) middleware.Responder -} - -// NewSubscriptionValidate creates a new http.Handler for the subscription validate operation -func NewSubscriptionValidate(ctx *middleware.Context, handler SubscriptionValidateHandler) *SubscriptionValidate { - return &SubscriptionValidate{Context: ctx, Handler: handler} -} - -/* - SubscriptionValidate swagger:route POST /subscription/validate OperatorAPI subscriptionValidate - -Validates subscription license -*/ -type SubscriptionValidate struct { - Context *middleware.Context - Handler SubscriptionValidateHandler -} - -func (o *SubscriptionValidate) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewSubscriptionValidateParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/subscription_validate_parameters.go b/operatorapi/operations/operator_api/subscription_validate_parameters.go deleted file mode 100644 index ab633eca4..000000000 --- a/operatorapi/operations/operator_api/subscription_validate_parameters.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewSubscriptionValidateParams creates a new SubscriptionValidateParams object -// -// There are no default values defined in the spec. -func NewSubscriptionValidateParams() SubscriptionValidateParams { - - return SubscriptionValidateParams{} -} - -// SubscriptionValidateParams contains all the bound params for the subscription validate operation -// typically these are obtained from a http.Request -// -// swagger:parameters SubscriptionValidate -type SubscriptionValidateParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.SubscriptionValidateRequest -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewSubscriptionValidateParams() beforehand. -func (o *SubscriptionValidateParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.SubscriptionValidateRequest - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/operator_api/subscription_validate_responses.go b/operatorapi/operations/operator_api/subscription_validate_responses.go deleted file mode 100644 index eb4dc4001..000000000 --- a/operatorapi/operations/operator_api/subscription_validate_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// SubscriptionValidateOKCode is the HTTP code returned for type SubscriptionValidateOK -const SubscriptionValidateOKCode int = 200 - -/* -SubscriptionValidateOK A successful response. - -swagger:response subscriptionValidateOK -*/ -type SubscriptionValidateOK struct { - - /* - In: Body - */ - Payload *models.License `json:"body,omitempty"` -} - -// NewSubscriptionValidateOK creates SubscriptionValidateOK with default headers values -func NewSubscriptionValidateOK() *SubscriptionValidateOK { - - return &SubscriptionValidateOK{} -} - -// WithPayload adds the payload to the subscription validate o k response -func (o *SubscriptionValidateOK) WithPayload(payload *models.License) *SubscriptionValidateOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the subscription validate o k response -func (o *SubscriptionValidateOK) SetPayload(payload *models.License) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SubscriptionValidateOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -SubscriptionValidateDefault Generic error response. - -swagger:response subscriptionValidateDefault -*/ -type SubscriptionValidateDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewSubscriptionValidateDefault creates SubscriptionValidateDefault with default headers values -func NewSubscriptionValidateDefault(code int) *SubscriptionValidateDefault { - if code <= 0 { - code = 500 - } - - return &SubscriptionValidateDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the subscription validate default response -func (o *SubscriptionValidateDefault) WithStatusCode(code int) *SubscriptionValidateDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the subscription validate default response -func (o *SubscriptionValidateDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the subscription validate default response -func (o *SubscriptionValidateDefault) WithPayload(payload *models.Error) *SubscriptionValidateDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the subscription validate default response -func (o *SubscriptionValidateDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SubscriptionValidateDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/subscription_validate_urlbuilder.go b/operatorapi/operations/operator_api/subscription_validate_urlbuilder.go deleted file mode 100644 index 6276110f6..000000000 --- a/operatorapi/operations/operator_api/subscription_validate_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// SubscriptionValidateURL generates an URL for the subscription validate operation -type SubscriptionValidateURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SubscriptionValidateURL) WithBasePath(bp string) *SubscriptionValidateURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SubscriptionValidateURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *SubscriptionValidateURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/subscription/validate" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *SubscriptionValidateURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *SubscriptionValidateURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *SubscriptionValidateURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on SubscriptionValidateURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on SubscriptionValidateURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *SubscriptionValidateURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/tenant_add_pool.go b/operatorapi/operations/operator_api/tenant_add_pool.go deleted file mode 100644 index 24a65655a..000000000 --- a/operatorapi/operations/operator_api/tenant_add_pool.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// TenantAddPoolHandlerFunc turns a function with the right signature into a tenant add pool handler -type TenantAddPoolHandlerFunc func(TenantAddPoolParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn TenantAddPoolHandlerFunc) Handle(params TenantAddPoolParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// TenantAddPoolHandler interface for that can handle valid tenant add pool params -type TenantAddPoolHandler interface { - Handle(TenantAddPoolParams, *models.Principal) middleware.Responder -} - -// NewTenantAddPool creates a new http.Handler for the tenant add pool operation -func NewTenantAddPool(ctx *middleware.Context, handler TenantAddPoolHandler) *TenantAddPool { - return &TenantAddPool{Context: ctx, Handler: handler} -} - -/* - TenantAddPool swagger:route POST /namespaces/{namespace}/tenants/{tenant}/pools OperatorAPI tenantAddPool - -Tenant Add Pool -*/ -type TenantAddPool struct { - Context *middleware.Context - Handler TenantAddPoolHandler -} - -func (o *TenantAddPool) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewTenantAddPoolParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/tenant_add_pool_parameters.go b/operatorapi/operations/operator_api/tenant_add_pool_parameters.go deleted file mode 100644 index 219268349..000000000 --- a/operatorapi/operations/operator_api/tenant_add_pool_parameters.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewTenantAddPoolParams creates a new TenantAddPoolParams object -// -// There are no default values defined in the spec. -func NewTenantAddPoolParams() TenantAddPoolParams { - - return TenantAddPoolParams{} -} - -// TenantAddPoolParams contains all the bound params for the tenant add pool operation -// typically these are obtained from a http.Request -// -// swagger:parameters TenantAddPool -type TenantAddPoolParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.Pool - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewTenantAddPoolParams() beforehand. -func (o *TenantAddPoolParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Pool - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *TenantAddPoolParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *TenantAddPoolParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/tenant_add_pool_responses.go b/operatorapi/operations/operator_api/tenant_add_pool_responses.go deleted file mode 100644 index 4f8440b0c..000000000 --- a/operatorapi/operations/operator_api/tenant_add_pool_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// TenantAddPoolCreatedCode is the HTTP code returned for type TenantAddPoolCreated -const TenantAddPoolCreatedCode int = 201 - -/* -TenantAddPoolCreated A successful response. - -swagger:response tenantAddPoolCreated -*/ -type TenantAddPoolCreated struct { -} - -// NewTenantAddPoolCreated creates TenantAddPoolCreated with default headers values -func NewTenantAddPoolCreated() *TenantAddPoolCreated { - - return &TenantAddPoolCreated{} -} - -// WriteResponse to the client -func (o *TenantAddPoolCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -/* -TenantAddPoolDefault Generic error response. - -swagger:response tenantAddPoolDefault -*/ -type TenantAddPoolDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewTenantAddPoolDefault creates TenantAddPoolDefault with default headers values -func NewTenantAddPoolDefault(code int) *TenantAddPoolDefault { - if code <= 0 { - code = 500 - } - - return &TenantAddPoolDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the tenant add pool default response -func (o *TenantAddPoolDefault) WithStatusCode(code int) *TenantAddPoolDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the tenant add pool default response -func (o *TenantAddPoolDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the tenant add pool default response -func (o *TenantAddPoolDefault) WithPayload(payload *models.Error) *TenantAddPoolDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tenant add pool default response -func (o *TenantAddPoolDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TenantAddPoolDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/tenant_add_pool_urlbuilder.go b/operatorapi/operations/operator_api/tenant_add_pool_urlbuilder.go deleted file mode 100644 index eaae33d6b..000000000 --- a/operatorapi/operations/operator_api/tenant_add_pool_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// TenantAddPoolURL generates an URL for the tenant add pool operation -type TenantAddPoolURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantAddPoolURL) WithBasePath(bp string) *TenantAddPoolURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantAddPoolURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *TenantAddPoolURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/pools" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on TenantAddPoolURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on TenantAddPoolURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *TenantAddPoolURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *TenantAddPoolURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *TenantAddPoolURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on TenantAddPoolURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on TenantAddPoolURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *TenantAddPoolURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/tenant_configuration.go b/operatorapi/operations/operator_api/tenant_configuration.go deleted file mode 100644 index 8753e1e9d..000000000 --- a/operatorapi/operations/operator_api/tenant_configuration.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// TenantConfigurationHandlerFunc turns a function with the right signature into a tenant configuration handler -type TenantConfigurationHandlerFunc func(TenantConfigurationParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn TenantConfigurationHandlerFunc) Handle(params TenantConfigurationParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// TenantConfigurationHandler interface for that can handle valid tenant configuration params -type TenantConfigurationHandler interface { - Handle(TenantConfigurationParams, *models.Principal) middleware.Responder -} - -// NewTenantConfiguration creates a new http.Handler for the tenant configuration operation -func NewTenantConfiguration(ctx *middleware.Context, handler TenantConfigurationHandler) *TenantConfiguration { - return &TenantConfiguration{Context: ctx, Handler: handler} -} - -/* - TenantConfiguration swagger:route GET /namespaces/{namespace}/tenants/{tenant}/configuration OperatorAPI tenantConfiguration - -Tenant Configuration -*/ -type TenantConfiguration struct { - Context *middleware.Context - Handler TenantConfigurationHandler -} - -func (o *TenantConfiguration) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewTenantConfigurationParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/tenant_configuration_parameters.go b/operatorapi/operations/operator_api/tenant_configuration_parameters.go deleted file mode 100644 index cb9811bf3..000000000 --- a/operatorapi/operations/operator_api/tenant_configuration_parameters.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewTenantConfigurationParams creates a new TenantConfigurationParams object -// -// There are no default values defined in the spec. -func NewTenantConfigurationParams() TenantConfigurationParams { - - return TenantConfigurationParams{} -} - -// TenantConfigurationParams contains all the bound params for the tenant configuration operation -// typically these are obtained from a http.Request -// -// swagger:parameters TenantConfiguration -type TenantConfigurationParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewTenantConfigurationParams() beforehand. -func (o *TenantConfigurationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *TenantConfigurationParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *TenantConfigurationParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/tenant_configuration_responses.go b/operatorapi/operations/operator_api/tenant_configuration_responses.go deleted file mode 100644 index 5b2ccf9bf..000000000 --- a/operatorapi/operations/operator_api/tenant_configuration_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// TenantConfigurationOKCode is the HTTP code returned for type TenantConfigurationOK -const TenantConfigurationOKCode int = 200 - -/* -TenantConfigurationOK A successful response. - -swagger:response tenantConfigurationOK -*/ -type TenantConfigurationOK struct { - - /* - In: Body - */ - Payload *models.TenantConfigurationResponse `json:"body,omitempty"` -} - -// NewTenantConfigurationOK creates TenantConfigurationOK with default headers values -func NewTenantConfigurationOK() *TenantConfigurationOK { - - return &TenantConfigurationOK{} -} - -// WithPayload adds the payload to the tenant configuration o k response -func (o *TenantConfigurationOK) WithPayload(payload *models.TenantConfigurationResponse) *TenantConfigurationOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tenant configuration o k response -func (o *TenantConfigurationOK) SetPayload(payload *models.TenantConfigurationResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TenantConfigurationOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -TenantConfigurationDefault Generic error response. - -swagger:response tenantConfigurationDefault -*/ -type TenantConfigurationDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewTenantConfigurationDefault creates TenantConfigurationDefault with default headers values -func NewTenantConfigurationDefault(code int) *TenantConfigurationDefault { - if code <= 0 { - code = 500 - } - - return &TenantConfigurationDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the tenant configuration default response -func (o *TenantConfigurationDefault) WithStatusCode(code int) *TenantConfigurationDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the tenant configuration default response -func (o *TenantConfigurationDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the tenant configuration default response -func (o *TenantConfigurationDefault) WithPayload(payload *models.Error) *TenantConfigurationDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tenant configuration default response -func (o *TenantConfigurationDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TenantConfigurationDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/tenant_configuration_urlbuilder.go b/operatorapi/operations/operator_api/tenant_configuration_urlbuilder.go deleted file mode 100644 index 00927c787..000000000 --- a/operatorapi/operations/operator_api/tenant_configuration_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// TenantConfigurationURL generates an URL for the tenant configuration operation -type TenantConfigurationURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantConfigurationURL) WithBasePath(bp string) *TenantConfigurationURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantConfigurationURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *TenantConfigurationURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/configuration" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on TenantConfigurationURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on TenantConfigurationURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *TenantConfigurationURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *TenantConfigurationURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *TenantConfigurationURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on TenantConfigurationURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on TenantConfigurationURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *TenantConfigurationURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/tenant_delete_encryption.go b/operatorapi/operations/operator_api/tenant_delete_encryption.go deleted file mode 100644 index 2dafbb904..000000000 --- a/operatorapi/operations/operator_api/tenant_delete_encryption.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// TenantDeleteEncryptionHandlerFunc turns a function with the right signature into a tenant delete encryption handler -type TenantDeleteEncryptionHandlerFunc func(TenantDeleteEncryptionParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn TenantDeleteEncryptionHandlerFunc) Handle(params TenantDeleteEncryptionParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// TenantDeleteEncryptionHandler interface for that can handle valid tenant delete encryption params -type TenantDeleteEncryptionHandler interface { - Handle(TenantDeleteEncryptionParams, *models.Principal) middleware.Responder -} - -// NewTenantDeleteEncryption creates a new http.Handler for the tenant delete encryption operation -func NewTenantDeleteEncryption(ctx *middleware.Context, handler TenantDeleteEncryptionHandler) *TenantDeleteEncryption { - return &TenantDeleteEncryption{Context: ctx, Handler: handler} -} - -/* - TenantDeleteEncryption swagger:route DELETE /namespaces/{namespace}/tenants/{tenant}/encryption OperatorAPI tenantDeleteEncryption - -Tenant Delete Encryption -*/ -type TenantDeleteEncryption struct { - Context *middleware.Context - Handler TenantDeleteEncryptionHandler -} - -func (o *TenantDeleteEncryption) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewTenantDeleteEncryptionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/tenant_delete_encryption_parameters.go b/operatorapi/operations/operator_api/tenant_delete_encryption_parameters.go deleted file mode 100644 index 07e167f15..000000000 --- a/operatorapi/operations/operator_api/tenant_delete_encryption_parameters.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewTenantDeleteEncryptionParams creates a new TenantDeleteEncryptionParams object -// -// There are no default values defined in the spec. -func NewTenantDeleteEncryptionParams() TenantDeleteEncryptionParams { - - return TenantDeleteEncryptionParams{} -} - -// TenantDeleteEncryptionParams contains all the bound params for the tenant delete encryption operation -// typically these are obtained from a http.Request -// -// swagger:parameters TenantDeleteEncryption -type TenantDeleteEncryptionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewTenantDeleteEncryptionParams() beforehand. -func (o *TenantDeleteEncryptionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *TenantDeleteEncryptionParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *TenantDeleteEncryptionParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/tenant_delete_encryption_responses.go b/operatorapi/operations/operator_api/tenant_delete_encryption_responses.go deleted file mode 100644 index c7cb506c9..000000000 --- a/operatorapi/operations/operator_api/tenant_delete_encryption_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// TenantDeleteEncryptionNoContentCode is the HTTP code returned for type TenantDeleteEncryptionNoContent -const TenantDeleteEncryptionNoContentCode int = 204 - -/* -TenantDeleteEncryptionNoContent A successful response. - -swagger:response tenantDeleteEncryptionNoContent -*/ -type TenantDeleteEncryptionNoContent struct { -} - -// NewTenantDeleteEncryptionNoContent creates TenantDeleteEncryptionNoContent with default headers values -func NewTenantDeleteEncryptionNoContent() *TenantDeleteEncryptionNoContent { - - return &TenantDeleteEncryptionNoContent{} -} - -// WriteResponse to the client -func (o *TenantDeleteEncryptionNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -TenantDeleteEncryptionDefault Generic error response. - -swagger:response tenantDeleteEncryptionDefault -*/ -type TenantDeleteEncryptionDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewTenantDeleteEncryptionDefault creates TenantDeleteEncryptionDefault with default headers values -func NewTenantDeleteEncryptionDefault(code int) *TenantDeleteEncryptionDefault { - if code <= 0 { - code = 500 - } - - return &TenantDeleteEncryptionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the tenant delete encryption default response -func (o *TenantDeleteEncryptionDefault) WithStatusCode(code int) *TenantDeleteEncryptionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the tenant delete encryption default response -func (o *TenantDeleteEncryptionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the tenant delete encryption default response -func (o *TenantDeleteEncryptionDefault) WithPayload(payload *models.Error) *TenantDeleteEncryptionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tenant delete encryption default response -func (o *TenantDeleteEncryptionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TenantDeleteEncryptionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/tenant_delete_encryption_urlbuilder.go b/operatorapi/operations/operator_api/tenant_delete_encryption_urlbuilder.go deleted file mode 100644 index 4d3da76a8..000000000 --- a/operatorapi/operations/operator_api/tenant_delete_encryption_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// TenantDeleteEncryptionURL generates an URL for the tenant delete encryption operation -type TenantDeleteEncryptionURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantDeleteEncryptionURL) WithBasePath(bp string) *TenantDeleteEncryptionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantDeleteEncryptionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *TenantDeleteEncryptionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/encryption" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on TenantDeleteEncryptionURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on TenantDeleteEncryptionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *TenantDeleteEncryptionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *TenantDeleteEncryptionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *TenantDeleteEncryptionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on TenantDeleteEncryptionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on TenantDeleteEncryptionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *TenantDeleteEncryptionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/tenant_details.go b/operatorapi/operations/operator_api/tenant_details.go deleted file mode 100644 index c536f496f..000000000 --- a/operatorapi/operations/operator_api/tenant_details.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// TenantDetailsHandlerFunc turns a function with the right signature into a tenant details handler -type TenantDetailsHandlerFunc func(TenantDetailsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn TenantDetailsHandlerFunc) Handle(params TenantDetailsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// TenantDetailsHandler interface for that can handle valid tenant details params -type TenantDetailsHandler interface { - Handle(TenantDetailsParams, *models.Principal) middleware.Responder -} - -// NewTenantDetails creates a new http.Handler for the tenant details operation -func NewTenantDetails(ctx *middleware.Context, handler TenantDetailsHandler) *TenantDetails { - return &TenantDetails{Context: ctx, Handler: handler} -} - -/* - TenantDetails swagger:route GET /namespaces/{namespace}/tenants/{tenant} OperatorAPI tenantDetails - -Tenant Details -*/ -type TenantDetails struct { - Context *middleware.Context - Handler TenantDetailsHandler -} - -func (o *TenantDetails) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewTenantDetailsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/tenant_details_parameters.go b/operatorapi/operations/operator_api/tenant_details_parameters.go deleted file mode 100644 index b5ce78a49..000000000 --- a/operatorapi/operations/operator_api/tenant_details_parameters.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewTenantDetailsParams creates a new TenantDetailsParams object -// -// There are no default values defined in the spec. -func NewTenantDetailsParams() TenantDetailsParams { - - return TenantDetailsParams{} -} - -// TenantDetailsParams contains all the bound params for the tenant details operation -// typically these are obtained from a http.Request -// -// swagger:parameters TenantDetails -type TenantDetailsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewTenantDetailsParams() beforehand. -func (o *TenantDetailsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *TenantDetailsParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *TenantDetailsParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/tenant_details_responses.go b/operatorapi/operations/operator_api/tenant_details_responses.go deleted file mode 100644 index e4515c014..000000000 --- a/operatorapi/operations/operator_api/tenant_details_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// TenantDetailsOKCode is the HTTP code returned for type TenantDetailsOK -const TenantDetailsOKCode int = 200 - -/* -TenantDetailsOK A successful response. - -swagger:response tenantDetailsOK -*/ -type TenantDetailsOK struct { - - /* - In: Body - */ - Payload *models.Tenant `json:"body,omitempty"` -} - -// NewTenantDetailsOK creates TenantDetailsOK with default headers values -func NewTenantDetailsOK() *TenantDetailsOK { - - return &TenantDetailsOK{} -} - -// WithPayload adds the payload to the tenant details o k response -func (o *TenantDetailsOK) WithPayload(payload *models.Tenant) *TenantDetailsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tenant details o k response -func (o *TenantDetailsOK) SetPayload(payload *models.Tenant) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TenantDetailsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -TenantDetailsDefault Generic error response. - -swagger:response tenantDetailsDefault -*/ -type TenantDetailsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewTenantDetailsDefault creates TenantDetailsDefault with default headers values -func NewTenantDetailsDefault(code int) *TenantDetailsDefault { - if code <= 0 { - code = 500 - } - - return &TenantDetailsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the tenant details default response -func (o *TenantDetailsDefault) WithStatusCode(code int) *TenantDetailsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the tenant details default response -func (o *TenantDetailsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the tenant details default response -func (o *TenantDetailsDefault) WithPayload(payload *models.Error) *TenantDetailsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tenant details default response -func (o *TenantDetailsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TenantDetailsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/tenant_details_urlbuilder.go b/operatorapi/operations/operator_api/tenant_details_urlbuilder.go deleted file mode 100644 index bdbb9ac2d..000000000 --- a/operatorapi/operations/operator_api/tenant_details_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// TenantDetailsURL generates an URL for the tenant details operation -type TenantDetailsURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantDetailsURL) WithBasePath(bp string) *TenantDetailsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantDetailsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *TenantDetailsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on TenantDetailsURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on TenantDetailsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *TenantDetailsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *TenantDetailsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *TenantDetailsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on TenantDetailsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on TenantDetailsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *TenantDetailsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/tenant_encryption_info.go b/operatorapi/operations/operator_api/tenant_encryption_info.go deleted file mode 100644 index 033c06115..000000000 --- a/operatorapi/operations/operator_api/tenant_encryption_info.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// TenantEncryptionInfoHandlerFunc turns a function with the right signature into a tenant encryption info handler -type TenantEncryptionInfoHandlerFunc func(TenantEncryptionInfoParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn TenantEncryptionInfoHandlerFunc) Handle(params TenantEncryptionInfoParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// TenantEncryptionInfoHandler interface for that can handle valid tenant encryption info params -type TenantEncryptionInfoHandler interface { - Handle(TenantEncryptionInfoParams, *models.Principal) middleware.Responder -} - -// NewTenantEncryptionInfo creates a new http.Handler for the tenant encryption info operation -func NewTenantEncryptionInfo(ctx *middleware.Context, handler TenantEncryptionInfoHandler) *TenantEncryptionInfo { - return &TenantEncryptionInfo{Context: ctx, Handler: handler} -} - -/* - TenantEncryptionInfo swagger:route GET /namespaces/{namespace}/tenants/{tenant}/encryption OperatorAPI tenantEncryptionInfo - -Tenant Encryption Info -*/ -type TenantEncryptionInfo struct { - Context *middleware.Context - Handler TenantEncryptionInfoHandler -} - -func (o *TenantEncryptionInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewTenantEncryptionInfoParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/tenant_encryption_info_parameters.go b/operatorapi/operations/operator_api/tenant_encryption_info_parameters.go deleted file mode 100644 index 02148cc56..000000000 --- a/operatorapi/operations/operator_api/tenant_encryption_info_parameters.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewTenantEncryptionInfoParams creates a new TenantEncryptionInfoParams object -// -// There are no default values defined in the spec. -func NewTenantEncryptionInfoParams() TenantEncryptionInfoParams { - - return TenantEncryptionInfoParams{} -} - -// TenantEncryptionInfoParams contains all the bound params for the tenant encryption info operation -// typically these are obtained from a http.Request -// -// swagger:parameters TenantEncryptionInfo -type TenantEncryptionInfoParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewTenantEncryptionInfoParams() beforehand. -func (o *TenantEncryptionInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *TenantEncryptionInfoParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *TenantEncryptionInfoParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/tenant_encryption_info_responses.go b/operatorapi/operations/operator_api/tenant_encryption_info_responses.go deleted file mode 100644 index b2027e10c..000000000 --- a/operatorapi/operations/operator_api/tenant_encryption_info_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// TenantEncryptionInfoOKCode is the HTTP code returned for type TenantEncryptionInfoOK -const TenantEncryptionInfoOKCode int = 200 - -/* -TenantEncryptionInfoOK A successful response. - -swagger:response tenantEncryptionInfoOK -*/ -type TenantEncryptionInfoOK struct { - - /* - In: Body - */ - Payload *models.EncryptionConfigurationResponse `json:"body,omitempty"` -} - -// NewTenantEncryptionInfoOK creates TenantEncryptionInfoOK with default headers values -func NewTenantEncryptionInfoOK() *TenantEncryptionInfoOK { - - return &TenantEncryptionInfoOK{} -} - -// WithPayload adds the payload to the tenant encryption info o k response -func (o *TenantEncryptionInfoOK) WithPayload(payload *models.EncryptionConfigurationResponse) *TenantEncryptionInfoOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tenant encryption info o k response -func (o *TenantEncryptionInfoOK) SetPayload(payload *models.EncryptionConfigurationResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TenantEncryptionInfoOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -TenantEncryptionInfoDefault Generic error response. - -swagger:response tenantEncryptionInfoDefault -*/ -type TenantEncryptionInfoDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewTenantEncryptionInfoDefault creates TenantEncryptionInfoDefault with default headers values -func NewTenantEncryptionInfoDefault(code int) *TenantEncryptionInfoDefault { - if code <= 0 { - code = 500 - } - - return &TenantEncryptionInfoDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the tenant encryption info default response -func (o *TenantEncryptionInfoDefault) WithStatusCode(code int) *TenantEncryptionInfoDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the tenant encryption info default response -func (o *TenantEncryptionInfoDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the tenant encryption info default response -func (o *TenantEncryptionInfoDefault) WithPayload(payload *models.Error) *TenantEncryptionInfoDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tenant encryption info default response -func (o *TenantEncryptionInfoDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TenantEncryptionInfoDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/tenant_encryption_info_urlbuilder.go b/operatorapi/operations/operator_api/tenant_encryption_info_urlbuilder.go deleted file mode 100644 index af587eae1..000000000 --- a/operatorapi/operations/operator_api/tenant_encryption_info_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// TenantEncryptionInfoURL generates an URL for the tenant encryption info operation -type TenantEncryptionInfoURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantEncryptionInfoURL) WithBasePath(bp string) *TenantEncryptionInfoURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantEncryptionInfoURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *TenantEncryptionInfoURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/encryption" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on TenantEncryptionInfoURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on TenantEncryptionInfoURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *TenantEncryptionInfoURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *TenantEncryptionInfoURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *TenantEncryptionInfoURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on TenantEncryptionInfoURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on TenantEncryptionInfoURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *TenantEncryptionInfoURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/tenant_identity_provider.go b/operatorapi/operations/operator_api/tenant_identity_provider.go deleted file mode 100644 index 951a1f446..000000000 --- a/operatorapi/operations/operator_api/tenant_identity_provider.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// TenantIdentityProviderHandlerFunc turns a function with the right signature into a tenant identity provider handler -type TenantIdentityProviderHandlerFunc func(TenantIdentityProviderParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn TenantIdentityProviderHandlerFunc) Handle(params TenantIdentityProviderParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// TenantIdentityProviderHandler interface for that can handle valid tenant identity provider params -type TenantIdentityProviderHandler interface { - Handle(TenantIdentityProviderParams, *models.Principal) middleware.Responder -} - -// NewTenantIdentityProvider creates a new http.Handler for the tenant identity provider operation -func NewTenantIdentityProvider(ctx *middleware.Context, handler TenantIdentityProviderHandler) *TenantIdentityProvider { - return &TenantIdentityProvider{Context: ctx, Handler: handler} -} - -/* - TenantIdentityProvider swagger:route GET /namespaces/{namespace}/tenants/{tenant}/identity-provider OperatorAPI tenantIdentityProvider - -Tenant Identity Provider -*/ -type TenantIdentityProvider struct { - Context *middleware.Context - Handler TenantIdentityProviderHandler -} - -func (o *TenantIdentityProvider) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewTenantIdentityProviderParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/tenant_identity_provider_parameters.go b/operatorapi/operations/operator_api/tenant_identity_provider_parameters.go deleted file mode 100644 index 7525e6fff..000000000 --- a/operatorapi/operations/operator_api/tenant_identity_provider_parameters.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewTenantIdentityProviderParams creates a new TenantIdentityProviderParams object -// -// There are no default values defined in the spec. -func NewTenantIdentityProviderParams() TenantIdentityProviderParams { - - return TenantIdentityProviderParams{} -} - -// TenantIdentityProviderParams contains all the bound params for the tenant identity provider operation -// typically these are obtained from a http.Request -// -// swagger:parameters TenantIdentityProvider -type TenantIdentityProviderParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewTenantIdentityProviderParams() beforehand. -func (o *TenantIdentityProviderParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *TenantIdentityProviderParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *TenantIdentityProviderParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/tenant_identity_provider_responses.go b/operatorapi/operations/operator_api/tenant_identity_provider_responses.go deleted file mode 100644 index 2d03af136..000000000 --- a/operatorapi/operations/operator_api/tenant_identity_provider_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// TenantIdentityProviderOKCode is the HTTP code returned for type TenantIdentityProviderOK -const TenantIdentityProviderOKCode int = 200 - -/* -TenantIdentityProviderOK A successful response. - -swagger:response tenantIdentityProviderOK -*/ -type TenantIdentityProviderOK struct { - - /* - In: Body - */ - Payload *models.IdpConfiguration `json:"body,omitempty"` -} - -// NewTenantIdentityProviderOK creates TenantIdentityProviderOK with default headers values -func NewTenantIdentityProviderOK() *TenantIdentityProviderOK { - - return &TenantIdentityProviderOK{} -} - -// WithPayload adds the payload to the tenant identity provider o k response -func (o *TenantIdentityProviderOK) WithPayload(payload *models.IdpConfiguration) *TenantIdentityProviderOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tenant identity provider o k response -func (o *TenantIdentityProviderOK) SetPayload(payload *models.IdpConfiguration) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TenantIdentityProviderOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -TenantIdentityProviderDefault Generic error response. - -swagger:response tenantIdentityProviderDefault -*/ -type TenantIdentityProviderDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewTenantIdentityProviderDefault creates TenantIdentityProviderDefault with default headers values -func NewTenantIdentityProviderDefault(code int) *TenantIdentityProviderDefault { - if code <= 0 { - code = 500 - } - - return &TenantIdentityProviderDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the tenant identity provider default response -func (o *TenantIdentityProviderDefault) WithStatusCode(code int) *TenantIdentityProviderDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the tenant identity provider default response -func (o *TenantIdentityProviderDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the tenant identity provider default response -func (o *TenantIdentityProviderDefault) WithPayload(payload *models.Error) *TenantIdentityProviderDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tenant identity provider default response -func (o *TenantIdentityProviderDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TenantIdentityProviderDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/tenant_identity_provider_urlbuilder.go b/operatorapi/operations/operator_api/tenant_identity_provider_urlbuilder.go deleted file mode 100644 index ca375a952..000000000 --- a/operatorapi/operations/operator_api/tenant_identity_provider_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// TenantIdentityProviderURL generates an URL for the tenant identity provider operation -type TenantIdentityProviderURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantIdentityProviderURL) WithBasePath(bp string) *TenantIdentityProviderURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantIdentityProviderURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *TenantIdentityProviderURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/identity-provider" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on TenantIdentityProviderURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on TenantIdentityProviderURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *TenantIdentityProviderURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *TenantIdentityProviderURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *TenantIdentityProviderURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on TenantIdentityProviderURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on TenantIdentityProviderURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *TenantIdentityProviderURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/tenant_security.go b/operatorapi/operations/operator_api/tenant_security.go deleted file mode 100644 index c184dde19..000000000 --- a/operatorapi/operations/operator_api/tenant_security.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// TenantSecurityHandlerFunc turns a function with the right signature into a tenant security handler -type TenantSecurityHandlerFunc func(TenantSecurityParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn TenantSecurityHandlerFunc) Handle(params TenantSecurityParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// TenantSecurityHandler interface for that can handle valid tenant security params -type TenantSecurityHandler interface { - Handle(TenantSecurityParams, *models.Principal) middleware.Responder -} - -// NewTenantSecurity creates a new http.Handler for the tenant security operation -func NewTenantSecurity(ctx *middleware.Context, handler TenantSecurityHandler) *TenantSecurity { - return &TenantSecurity{Context: ctx, Handler: handler} -} - -/* - TenantSecurity swagger:route GET /namespaces/{namespace}/tenants/{tenant}/security OperatorAPI tenantSecurity - -Tenant Security -*/ -type TenantSecurity struct { - Context *middleware.Context - Handler TenantSecurityHandler -} - -func (o *TenantSecurity) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewTenantSecurityParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/tenant_security_parameters.go b/operatorapi/operations/operator_api/tenant_security_parameters.go deleted file mode 100644 index f57679d87..000000000 --- a/operatorapi/operations/operator_api/tenant_security_parameters.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewTenantSecurityParams creates a new TenantSecurityParams object -// -// There are no default values defined in the spec. -func NewTenantSecurityParams() TenantSecurityParams { - - return TenantSecurityParams{} -} - -// TenantSecurityParams contains all the bound params for the tenant security operation -// typically these are obtained from a http.Request -// -// swagger:parameters TenantSecurity -type TenantSecurityParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewTenantSecurityParams() beforehand. -func (o *TenantSecurityParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *TenantSecurityParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *TenantSecurityParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/tenant_security_responses.go b/operatorapi/operations/operator_api/tenant_security_responses.go deleted file mode 100644 index dba64fb8e..000000000 --- a/operatorapi/operations/operator_api/tenant_security_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// TenantSecurityOKCode is the HTTP code returned for type TenantSecurityOK -const TenantSecurityOKCode int = 200 - -/* -TenantSecurityOK A successful response. - -swagger:response tenantSecurityOK -*/ -type TenantSecurityOK struct { - - /* - In: Body - */ - Payload *models.TenantSecurityResponse `json:"body,omitempty"` -} - -// NewTenantSecurityOK creates TenantSecurityOK with default headers values -func NewTenantSecurityOK() *TenantSecurityOK { - - return &TenantSecurityOK{} -} - -// WithPayload adds the payload to the tenant security o k response -func (o *TenantSecurityOK) WithPayload(payload *models.TenantSecurityResponse) *TenantSecurityOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tenant security o k response -func (o *TenantSecurityOK) SetPayload(payload *models.TenantSecurityResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TenantSecurityOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -TenantSecurityDefault Generic error response. - -swagger:response tenantSecurityDefault -*/ -type TenantSecurityDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewTenantSecurityDefault creates TenantSecurityDefault with default headers values -func NewTenantSecurityDefault(code int) *TenantSecurityDefault { - if code <= 0 { - code = 500 - } - - return &TenantSecurityDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the tenant security default response -func (o *TenantSecurityDefault) WithStatusCode(code int) *TenantSecurityDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the tenant security default response -func (o *TenantSecurityDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the tenant security default response -func (o *TenantSecurityDefault) WithPayload(payload *models.Error) *TenantSecurityDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tenant security default response -func (o *TenantSecurityDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TenantSecurityDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/tenant_security_urlbuilder.go b/operatorapi/operations/operator_api/tenant_security_urlbuilder.go deleted file mode 100644 index 671698c00..000000000 --- a/operatorapi/operations/operator_api/tenant_security_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// TenantSecurityURL generates an URL for the tenant security operation -type TenantSecurityURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantSecurityURL) WithBasePath(bp string) *TenantSecurityURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantSecurityURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *TenantSecurityURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/security" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on TenantSecurityURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on TenantSecurityURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *TenantSecurityURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *TenantSecurityURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *TenantSecurityURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on TenantSecurityURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on TenantSecurityURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *TenantSecurityURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/tenant_update_certificate.go b/operatorapi/operations/operator_api/tenant_update_certificate.go deleted file mode 100644 index e86944922..000000000 --- a/operatorapi/operations/operator_api/tenant_update_certificate.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// TenantUpdateCertificateHandlerFunc turns a function with the right signature into a tenant update certificate handler -type TenantUpdateCertificateHandlerFunc func(TenantUpdateCertificateParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn TenantUpdateCertificateHandlerFunc) Handle(params TenantUpdateCertificateParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// TenantUpdateCertificateHandler interface for that can handle valid tenant update certificate params -type TenantUpdateCertificateHandler interface { - Handle(TenantUpdateCertificateParams, *models.Principal) middleware.Responder -} - -// NewTenantUpdateCertificate creates a new http.Handler for the tenant update certificate operation -func NewTenantUpdateCertificate(ctx *middleware.Context, handler TenantUpdateCertificateHandler) *TenantUpdateCertificate { - return &TenantUpdateCertificate{Context: ctx, Handler: handler} -} - -/* - TenantUpdateCertificate swagger:route PUT /namespaces/{namespace}/tenants/{tenant}/certificates OperatorAPI tenantUpdateCertificate - -Tenant Update Certificates -*/ -type TenantUpdateCertificate struct { - Context *middleware.Context - Handler TenantUpdateCertificateHandler -} - -func (o *TenantUpdateCertificate) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewTenantUpdateCertificateParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/tenant_update_certificate_parameters.go b/operatorapi/operations/operator_api/tenant_update_certificate_parameters.go deleted file mode 100644 index 4c99b6abc..000000000 --- a/operatorapi/operations/operator_api/tenant_update_certificate_parameters.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewTenantUpdateCertificateParams creates a new TenantUpdateCertificateParams object -// -// There are no default values defined in the spec. -func NewTenantUpdateCertificateParams() TenantUpdateCertificateParams { - - return TenantUpdateCertificateParams{} -} - -// TenantUpdateCertificateParams contains all the bound params for the tenant update certificate operation -// typically these are obtained from a http.Request -// -// swagger:parameters TenantUpdateCertificate -type TenantUpdateCertificateParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.TLSConfiguration - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewTenantUpdateCertificateParams() beforehand. -func (o *TenantUpdateCertificateParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TLSConfiguration - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *TenantUpdateCertificateParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *TenantUpdateCertificateParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/tenant_update_certificate_responses.go b/operatorapi/operations/operator_api/tenant_update_certificate_responses.go deleted file mode 100644 index 2caa169c2..000000000 --- a/operatorapi/operations/operator_api/tenant_update_certificate_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// TenantUpdateCertificateCreatedCode is the HTTP code returned for type TenantUpdateCertificateCreated -const TenantUpdateCertificateCreatedCode int = 201 - -/* -TenantUpdateCertificateCreated A successful response. - -swagger:response tenantUpdateCertificateCreated -*/ -type TenantUpdateCertificateCreated struct { -} - -// NewTenantUpdateCertificateCreated creates TenantUpdateCertificateCreated with default headers values -func NewTenantUpdateCertificateCreated() *TenantUpdateCertificateCreated { - - return &TenantUpdateCertificateCreated{} -} - -// WriteResponse to the client -func (o *TenantUpdateCertificateCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -/* -TenantUpdateCertificateDefault Generic error response. - -swagger:response tenantUpdateCertificateDefault -*/ -type TenantUpdateCertificateDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewTenantUpdateCertificateDefault creates TenantUpdateCertificateDefault with default headers values -func NewTenantUpdateCertificateDefault(code int) *TenantUpdateCertificateDefault { - if code <= 0 { - code = 500 - } - - return &TenantUpdateCertificateDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the tenant update certificate default response -func (o *TenantUpdateCertificateDefault) WithStatusCode(code int) *TenantUpdateCertificateDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the tenant update certificate default response -func (o *TenantUpdateCertificateDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the tenant update certificate default response -func (o *TenantUpdateCertificateDefault) WithPayload(payload *models.Error) *TenantUpdateCertificateDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tenant update certificate default response -func (o *TenantUpdateCertificateDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TenantUpdateCertificateDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/tenant_update_certificate_urlbuilder.go b/operatorapi/operations/operator_api/tenant_update_certificate_urlbuilder.go deleted file mode 100644 index 9a5ffb780..000000000 --- a/operatorapi/operations/operator_api/tenant_update_certificate_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// TenantUpdateCertificateURL generates an URL for the tenant update certificate operation -type TenantUpdateCertificateURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantUpdateCertificateURL) WithBasePath(bp string) *TenantUpdateCertificateURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantUpdateCertificateURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *TenantUpdateCertificateURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/certificates" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on TenantUpdateCertificateURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on TenantUpdateCertificateURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *TenantUpdateCertificateURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *TenantUpdateCertificateURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *TenantUpdateCertificateURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on TenantUpdateCertificateURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on TenantUpdateCertificateURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *TenantUpdateCertificateURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/tenant_update_encryption.go b/operatorapi/operations/operator_api/tenant_update_encryption.go deleted file mode 100644 index f378ee1e1..000000000 --- a/operatorapi/operations/operator_api/tenant_update_encryption.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// TenantUpdateEncryptionHandlerFunc turns a function with the right signature into a tenant update encryption handler -type TenantUpdateEncryptionHandlerFunc func(TenantUpdateEncryptionParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn TenantUpdateEncryptionHandlerFunc) Handle(params TenantUpdateEncryptionParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// TenantUpdateEncryptionHandler interface for that can handle valid tenant update encryption params -type TenantUpdateEncryptionHandler interface { - Handle(TenantUpdateEncryptionParams, *models.Principal) middleware.Responder -} - -// NewTenantUpdateEncryption creates a new http.Handler for the tenant update encryption operation -func NewTenantUpdateEncryption(ctx *middleware.Context, handler TenantUpdateEncryptionHandler) *TenantUpdateEncryption { - return &TenantUpdateEncryption{Context: ctx, Handler: handler} -} - -/* - TenantUpdateEncryption swagger:route PUT /namespaces/{namespace}/tenants/{tenant}/encryption OperatorAPI tenantUpdateEncryption - -Tenant Update Encryption -*/ -type TenantUpdateEncryption struct { - Context *middleware.Context - Handler TenantUpdateEncryptionHandler -} - -func (o *TenantUpdateEncryption) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewTenantUpdateEncryptionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/tenant_update_encryption_parameters.go b/operatorapi/operations/operator_api/tenant_update_encryption_parameters.go deleted file mode 100644 index 0ff7c205d..000000000 --- a/operatorapi/operations/operator_api/tenant_update_encryption_parameters.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewTenantUpdateEncryptionParams creates a new TenantUpdateEncryptionParams object -// -// There are no default values defined in the spec. -func NewTenantUpdateEncryptionParams() TenantUpdateEncryptionParams { - - return TenantUpdateEncryptionParams{} -} - -// TenantUpdateEncryptionParams contains all the bound params for the tenant update encryption operation -// typically these are obtained from a http.Request -// -// swagger:parameters TenantUpdateEncryption -type TenantUpdateEncryptionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.EncryptionConfiguration - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewTenantUpdateEncryptionParams() beforehand. -func (o *TenantUpdateEncryptionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.EncryptionConfiguration - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *TenantUpdateEncryptionParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *TenantUpdateEncryptionParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/tenant_update_encryption_responses.go b/operatorapi/operations/operator_api/tenant_update_encryption_responses.go deleted file mode 100644 index b8cce66bd..000000000 --- a/operatorapi/operations/operator_api/tenant_update_encryption_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// TenantUpdateEncryptionCreatedCode is the HTTP code returned for type TenantUpdateEncryptionCreated -const TenantUpdateEncryptionCreatedCode int = 201 - -/* -TenantUpdateEncryptionCreated A successful response. - -swagger:response tenantUpdateEncryptionCreated -*/ -type TenantUpdateEncryptionCreated struct { -} - -// NewTenantUpdateEncryptionCreated creates TenantUpdateEncryptionCreated with default headers values -func NewTenantUpdateEncryptionCreated() *TenantUpdateEncryptionCreated { - - return &TenantUpdateEncryptionCreated{} -} - -// WriteResponse to the client -func (o *TenantUpdateEncryptionCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -/* -TenantUpdateEncryptionDefault Generic error response. - -swagger:response tenantUpdateEncryptionDefault -*/ -type TenantUpdateEncryptionDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewTenantUpdateEncryptionDefault creates TenantUpdateEncryptionDefault with default headers values -func NewTenantUpdateEncryptionDefault(code int) *TenantUpdateEncryptionDefault { - if code <= 0 { - code = 500 - } - - return &TenantUpdateEncryptionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the tenant update encryption default response -func (o *TenantUpdateEncryptionDefault) WithStatusCode(code int) *TenantUpdateEncryptionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the tenant update encryption default response -func (o *TenantUpdateEncryptionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the tenant update encryption default response -func (o *TenantUpdateEncryptionDefault) WithPayload(payload *models.Error) *TenantUpdateEncryptionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tenant update encryption default response -func (o *TenantUpdateEncryptionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TenantUpdateEncryptionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/tenant_update_encryption_urlbuilder.go b/operatorapi/operations/operator_api/tenant_update_encryption_urlbuilder.go deleted file mode 100644 index 7666fd1fb..000000000 --- a/operatorapi/operations/operator_api/tenant_update_encryption_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// TenantUpdateEncryptionURL generates an URL for the tenant update encryption operation -type TenantUpdateEncryptionURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantUpdateEncryptionURL) WithBasePath(bp string) *TenantUpdateEncryptionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantUpdateEncryptionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *TenantUpdateEncryptionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/encryption" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on TenantUpdateEncryptionURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on TenantUpdateEncryptionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *TenantUpdateEncryptionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *TenantUpdateEncryptionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *TenantUpdateEncryptionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on TenantUpdateEncryptionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on TenantUpdateEncryptionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *TenantUpdateEncryptionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/tenant_update_pools.go b/operatorapi/operations/operator_api/tenant_update_pools.go deleted file mode 100644 index 5fad8e309..000000000 --- a/operatorapi/operations/operator_api/tenant_update_pools.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// TenantUpdatePoolsHandlerFunc turns a function with the right signature into a tenant update pools handler -type TenantUpdatePoolsHandlerFunc func(TenantUpdatePoolsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn TenantUpdatePoolsHandlerFunc) Handle(params TenantUpdatePoolsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// TenantUpdatePoolsHandler interface for that can handle valid tenant update pools params -type TenantUpdatePoolsHandler interface { - Handle(TenantUpdatePoolsParams, *models.Principal) middleware.Responder -} - -// NewTenantUpdatePools creates a new http.Handler for the tenant update pools operation -func NewTenantUpdatePools(ctx *middleware.Context, handler TenantUpdatePoolsHandler) *TenantUpdatePools { - return &TenantUpdatePools{Context: ctx, Handler: handler} -} - -/* - TenantUpdatePools swagger:route PUT /namespaces/{namespace}/tenants/{tenant}/pools OperatorAPI tenantUpdatePools - -Tenant Update Pools -*/ -type TenantUpdatePools struct { - Context *middleware.Context - Handler TenantUpdatePoolsHandler -} - -func (o *TenantUpdatePools) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewTenantUpdatePoolsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/tenant_update_pools_parameters.go b/operatorapi/operations/operator_api/tenant_update_pools_parameters.go deleted file mode 100644 index 316b04790..000000000 --- a/operatorapi/operations/operator_api/tenant_update_pools_parameters.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewTenantUpdatePoolsParams creates a new TenantUpdatePoolsParams object -// -// There are no default values defined in the spec. -func NewTenantUpdatePoolsParams() TenantUpdatePoolsParams { - - return TenantUpdatePoolsParams{} -} - -// TenantUpdatePoolsParams contains all the bound params for the tenant update pools operation -// typically these are obtained from a http.Request -// -// swagger:parameters TenantUpdatePools -type TenantUpdatePoolsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.PoolUpdateRequest - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewTenantUpdatePoolsParams() beforehand. -func (o *TenantUpdatePoolsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.PoolUpdateRequest - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *TenantUpdatePoolsParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *TenantUpdatePoolsParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/tenant_update_pools_responses.go b/operatorapi/operations/operator_api/tenant_update_pools_responses.go deleted file mode 100644 index 8bd3bb583..000000000 --- a/operatorapi/operations/operator_api/tenant_update_pools_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// TenantUpdatePoolsOKCode is the HTTP code returned for type TenantUpdatePoolsOK -const TenantUpdatePoolsOKCode int = 200 - -/* -TenantUpdatePoolsOK A successful response. - -swagger:response tenantUpdatePoolsOK -*/ -type TenantUpdatePoolsOK struct { - - /* - In: Body - */ - Payload *models.Tenant `json:"body,omitempty"` -} - -// NewTenantUpdatePoolsOK creates TenantUpdatePoolsOK with default headers values -func NewTenantUpdatePoolsOK() *TenantUpdatePoolsOK { - - return &TenantUpdatePoolsOK{} -} - -// WithPayload adds the payload to the tenant update pools o k response -func (o *TenantUpdatePoolsOK) WithPayload(payload *models.Tenant) *TenantUpdatePoolsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tenant update pools o k response -func (o *TenantUpdatePoolsOK) SetPayload(payload *models.Tenant) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TenantUpdatePoolsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -TenantUpdatePoolsDefault Generic error response. - -swagger:response tenantUpdatePoolsDefault -*/ -type TenantUpdatePoolsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewTenantUpdatePoolsDefault creates TenantUpdatePoolsDefault with default headers values -func NewTenantUpdatePoolsDefault(code int) *TenantUpdatePoolsDefault { - if code <= 0 { - code = 500 - } - - return &TenantUpdatePoolsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the tenant update pools default response -func (o *TenantUpdatePoolsDefault) WithStatusCode(code int) *TenantUpdatePoolsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the tenant update pools default response -func (o *TenantUpdatePoolsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the tenant update pools default response -func (o *TenantUpdatePoolsDefault) WithPayload(payload *models.Error) *TenantUpdatePoolsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tenant update pools default response -func (o *TenantUpdatePoolsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TenantUpdatePoolsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/tenant_update_pools_urlbuilder.go b/operatorapi/operations/operator_api/tenant_update_pools_urlbuilder.go deleted file mode 100644 index 6b23f032d..000000000 --- a/operatorapi/operations/operator_api/tenant_update_pools_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// TenantUpdatePoolsURL generates an URL for the tenant update pools operation -type TenantUpdatePoolsURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantUpdatePoolsURL) WithBasePath(bp string) *TenantUpdatePoolsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *TenantUpdatePoolsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *TenantUpdatePoolsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/pools" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on TenantUpdatePoolsURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on TenantUpdatePoolsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *TenantUpdatePoolsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *TenantUpdatePoolsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *TenantUpdatePoolsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on TenantUpdatePoolsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on TenantUpdatePoolsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *TenantUpdatePoolsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/update_tenant.go b/operatorapi/operations/operator_api/update_tenant.go deleted file mode 100644 index b66b8de1c..000000000 --- a/operatorapi/operations/operator_api/update_tenant.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// UpdateTenantHandlerFunc turns a function with the right signature into a update tenant handler -type UpdateTenantHandlerFunc func(UpdateTenantParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn UpdateTenantHandlerFunc) Handle(params UpdateTenantParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// UpdateTenantHandler interface for that can handle valid update tenant params -type UpdateTenantHandler interface { - Handle(UpdateTenantParams, *models.Principal) middleware.Responder -} - -// NewUpdateTenant creates a new http.Handler for the update tenant operation -func NewUpdateTenant(ctx *middleware.Context, handler UpdateTenantHandler) *UpdateTenant { - return &UpdateTenant{Context: ctx, Handler: handler} -} - -/* - UpdateTenant swagger:route PUT /namespaces/{namespace}/tenants/{tenant} OperatorAPI updateTenant - -Update Tenant -*/ -type UpdateTenant struct { - Context *middleware.Context - Handler UpdateTenantHandler -} - -func (o *UpdateTenant) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewUpdateTenantParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/update_tenant_configuration.go b/operatorapi/operations/operator_api/update_tenant_configuration.go deleted file mode 100644 index 853387f75..000000000 --- a/operatorapi/operations/operator_api/update_tenant_configuration.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// UpdateTenantConfigurationHandlerFunc turns a function with the right signature into a update tenant configuration handler -type UpdateTenantConfigurationHandlerFunc func(UpdateTenantConfigurationParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn UpdateTenantConfigurationHandlerFunc) Handle(params UpdateTenantConfigurationParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// UpdateTenantConfigurationHandler interface for that can handle valid update tenant configuration params -type UpdateTenantConfigurationHandler interface { - Handle(UpdateTenantConfigurationParams, *models.Principal) middleware.Responder -} - -// NewUpdateTenantConfiguration creates a new http.Handler for the update tenant configuration operation -func NewUpdateTenantConfiguration(ctx *middleware.Context, handler UpdateTenantConfigurationHandler) *UpdateTenantConfiguration { - return &UpdateTenantConfiguration{Context: ctx, Handler: handler} -} - -/* - UpdateTenantConfiguration swagger:route PATCH /namespaces/{namespace}/tenants/{tenant}/configuration OperatorAPI updateTenantConfiguration - -Update Tenant Configuration -*/ -type UpdateTenantConfiguration struct { - Context *middleware.Context - Handler UpdateTenantConfigurationHandler -} - -func (o *UpdateTenantConfiguration) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewUpdateTenantConfigurationParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/update_tenant_configuration_parameters.go b/operatorapi/operations/operator_api/update_tenant_configuration_parameters.go deleted file mode 100644 index 6c7878e45..000000000 --- a/operatorapi/operations/operator_api/update_tenant_configuration_parameters.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewUpdateTenantConfigurationParams creates a new UpdateTenantConfigurationParams object -// -// There are no default values defined in the spec. -func NewUpdateTenantConfigurationParams() UpdateTenantConfigurationParams { - - return UpdateTenantConfigurationParams{} -} - -// UpdateTenantConfigurationParams contains all the bound params for the update tenant configuration operation -// typically these are obtained from a http.Request -// -// swagger:parameters UpdateTenantConfiguration -type UpdateTenantConfigurationParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.UpdateTenantConfigurationRequest - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewUpdateTenantConfigurationParams() beforehand. -func (o *UpdateTenantConfigurationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.UpdateTenantConfigurationRequest - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *UpdateTenantConfigurationParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *UpdateTenantConfigurationParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/update_tenant_configuration_responses.go b/operatorapi/operations/operator_api/update_tenant_configuration_responses.go deleted file mode 100644 index 58e8d1f85..000000000 --- a/operatorapi/operations/operator_api/update_tenant_configuration_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// UpdateTenantConfigurationNoContentCode is the HTTP code returned for type UpdateTenantConfigurationNoContent -const UpdateTenantConfigurationNoContentCode int = 204 - -/* -UpdateTenantConfigurationNoContent A successful response. - -swagger:response updateTenantConfigurationNoContent -*/ -type UpdateTenantConfigurationNoContent struct { -} - -// NewUpdateTenantConfigurationNoContent creates UpdateTenantConfigurationNoContent with default headers values -func NewUpdateTenantConfigurationNoContent() *UpdateTenantConfigurationNoContent { - - return &UpdateTenantConfigurationNoContent{} -} - -// WriteResponse to the client -func (o *UpdateTenantConfigurationNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -UpdateTenantConfigurationDefault Generic error response. - -swagger:response updateTenantConfigurationDefault -*/ -type UpdateTenantConfigurationDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewUpdateTenantConfigurationDefault creates UpdateTenantConfigurationDefault with default headers values -func NewUpdateTenantConfigurationDefault(code int) *UpdateTenantConfigurationDefault { - if code <= 0 { - code = 500 - } - - return &UpdateTenantConfigurationDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the update tenant configuration default response -func (o *UpdateTenantConfigurationDefault) WithStatusCode(code int) *UpdateTenantConfigurationDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the update tenant configuration default response -func (o *UpdateTenantConfigurationDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the update tenant configuration default response -func (o *UpdateTenantConfigurationDefault) WithPayload(payload *models.Error) *UpdateTenantConfigurationDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the update tenant configuration default response -func (o *UpdateTenantConfigurationDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *UpdateTenantConfigurationDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/update_tenant_configuration_urlbuilder.go b/operatorapi/operations/operator_api/update_tenant_configuration_urlbuilder.go deleted file mode 100644 index 83ac8f4e9..000000000 --- a/operatorapi/operations/operator_api/update_tenant_configuration_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// UpdateTenantConfigurationURL generates an URL for the update tenant configuration operation -type UpdateTenantConfigurationURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *UpdateTenantConfigurationURL) WithBasePath(bp string) *UpdateTenantConfigurationURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *UpdateTenantConfigurationURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *UpdateTenantConfigurationURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/configuration" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on UpdateTenantConfigurationURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on UpdateTenantConfigurationURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *UpdateTenantConfigurationURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *UpdateTenantConfigurationURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *UpdateTenantConfigurationURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on UpdateTenantConfigurationURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on UpdateTenantConfigurationURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *UpdateTenantConfigurationURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/update_tenant_domains.go b/operatorapi/operations/operator_api/update_tenant_domains.go deleted file mode 100644 index 62c11dca9..000000000 --- a/operatorapi/operations/operator_api/update_tenant_domains.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// UpdateTenantDomainsHandlerFunc turns a function with the right signature into a update tenant domains handler -type UpdateTenantDomainsHandlerFunc func(UpdateTenantDomainsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn UpdateTenantDomainsHandlerFunc) Handle(params UpdateTenantDomainsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// UpdateTenantDomainsHandler interface for that can handle valid update tenant domains params -type UpdateTenantDomainsHandler interface { - Handle(UpdateTenantDomainsParams, *models.Principal) middleware.Responder -} - -// NewUpdateTenantDomains creates a new http.Handler for the update tenant domains operation -func NewUpdateTenantDomains(ctx *middleware.Context, handler UpdateTenantDomainsHandler) *UpdateTenantDomains { - return &UpdateTenantDomains{Context: ctx, Handler: handler} -} - -/* - UpdateTenantDomains swagger:route PUT /namespaces/{namespace}/tenants/{tenant}/domains OperatorAPI updateTenantDomains - -Update Domains for a Tenant -*/ -type UpdateTenantDomains struct { - Context *middleware.Context - Handler UpdateTenantDomainsHandler -} - -func (o *UpdateTenantDomains) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewUpdateTenantDomainsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/update_tenant_domains_parameters.go b/operatorapi/operations/operator_api/update_tenant_domains_parameters.go deleted file mode 100644 index 16e3580b7..000000000 --- a/operatorapi/operations/operator_api/update_tenant_domains_parameters.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewUpdateTenantDomainsParams creates a new UpdateTenantDomainsParams object -// -// There are no default values defined in the spec. -func NewUpdateTenantDomainsParams() UpdateTenantDomainsParams { - - return UpdateTenantDomainsParams{} -} - -// UpdateTenantDomainsParams contains all the bound params for the update tenant domains operation -// typically these are obtained from a http.Request -// -// swagger:parameters UpdateTenantDomains -type UpdateTenantDomainsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.UpdateDomainsRequest - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewUpdateTenantDomainsParams() beforehand. -func (o *UpdateTenantDomainsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.UpdateDomainsRequest - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *UpdateTenantDomainsParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *UpdateTenantDomainsParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/update_tenant_domains_responses.go b/operatorapi/operations/operator_api/update_tenant_domains_responses.go deleted file mode 100644 index 2ac07989b..000000000 --- a/operatorapi/operations/operator_api/update_tenant_domains_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// UpdateTenantDomainsNoContentCode is the HTTP code returned for type UpdateTenantDomainsNoContent -const UpdateTenantDomainsNoContentCode int = 204 - -/* -UpdateTenantDomainsNoContent A successful response. - -swagger:response updateTenantDomainsNoContent -*/ -type UpdateTenantDomainsNoContent struct { -} - -// NewUpdateTenantDomainsNoContent creates UpdateTenantDomainsNoContent with default headers values -func NewUpdateTenantDomainsNoContent() *UpdateTenantDomainsNoContent { - - return &UpdateTenantDomainsNoContent{} -} - -// WriteResponse to the client -func (o *UpdateTenantDomainsNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -UpdateTenantDomainsDefault Generic error response. - -swagger:response updateTenantDomainsDefault -*/ -type UpdateTenantDomainsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewUpdateTenantDomainsDefault creates UpdateTenantDomainsDefault with default headers values -func NewUpdateTenantDomainsDefault(code int) *UpdateTenantDomainsDefault { - if code <= 0 { - code = 500 - } - - return &UpdateTenantDomainsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the update tenant domains default response -func (o *UpdateTenantDomainsDefault) WithStatusCode(code int) *UpdateTenantDomainsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the update tenant domains default response -func (o *UpdateTenantDomainsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the update tenant domains default response -func (o *UpdateTenantDomainsDefault) WithPayload(payload *models.Error) *UpdateTenantDomainsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the update tenant domains default response -func (o *UpdateTenantDomainsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *UpdateTenantDomainsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/update_tenant_domains_urlbuilder.go b/operatorapi/operations/operator_api/update_tenant_domains_urlbuilder.go deleted file mode 100644 index 606a8feb8..000000000 --- a/operatorapi/operations/operator_api/update_tenant_domains_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// UpdateTenantDomainsURL generates an URL for the update tenant domains operation -type UpdateTenantDomainsURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *UpdateTenantDomainsURL) WithBasePath(bp string) *UpdateTenantDomainsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *UpdateTenantDomainsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *UpdateTenantDomainsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/domains" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on UpdateTenantDomainsURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on UpdateTenantDomainsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *UpdateTenantDomainsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *UpdateTenantDomainsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *UpdateTenantDomainsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on UpdateTenantDomainsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on UpdateTenantDomainsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *UpdateTenantDomainsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/update_tenant_identity_provider.go b/operatorapi/operations/operator_api/update_tenant_identity_provider.go deleted file mode 100644 index f3a76670b..000000000 --- a/operatorapi/operations/operator_api/update_tenant_identity_provider.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// UpdateTenantIdentityProviderHandlerFunc turns a function with the right signature into a update tenant identity provider handler -type UpdateTenantIdentityProviderHandlerFunc func(UpdateTenantIdentityProviderParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn UpdateTenantIdentityProviderHandlerFunc) Handle(params UpdateTenantIdentityProviderParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// UpdateTenantIdentityProviderHandler interface for that can handle valid update tenant identity provider params -type UpdateTenantIdentityProviderHandler interface { - Handle(UpdateTenantIdentityProviderParams, *models.Principal) middleware.Responder -} - -// NewUpdateTenantIdentityProvider creates a new http.Handler for the update tenant identity provider operation -func NewUpdateTenantIdentityProvider(ctx *middleware.Context, handler UpdateTenantIdentityProviderHandler) *UpdateTenantIdentityProvider { - return &UpdateTenantIdentityProvider{Context: ctx, Handler: handler} -} - -/* - UpdateTenantIdentityProvider swagger:route POST /namespaces/{namespace}/tenants/{tenant}/identity-provider OperatorAPI updateTenantIdentityProvider - -Update Tenant Identity Provider -*/ -type UpdateTenantIdentityProvider struct { - Context *middleware.Context - Handler UpdateTenantIdentityProviderHandler -} - -func (o *UpdateTenantIdentityProvider) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewUpdateTenantIdentityProviderParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/update_tenant_identity_provider_parameters.go b/operatorapi/operations/operator_api/update_tenant_identity_provider_parameters.go deleted file mode 100644 index 4f2b6c152..000000000 --- a/operatorapi/operations/operator_api/update_tenant_identity_provider_parameters.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewUpdateTenantIdentityProviderParams creates a new UpdateTenantIdentityProviderParams object -// -// There are no default values defined in the spec. -func NewUpdateTenantIdentityProviderParams() UpdateTenantIdentityProviderParams { - - return UpdateTenantIdentityProviderParams{} -} - -// UpdateTenantIdentityProviderParams contains all the bound params for the update tenant identity provider operation -// typically these are obtained from a http.Request -// -// swagger:parameters UpdateTenantIdentityProvider -type UpdateTenantIdentityProviderParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.IdpConfiguration - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewUpdateTenantIdentityProviderParams() beforehand. -func (o *UpdateTenantIdentityProviderParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.IdpConfiguration - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *UpdateTenantIdentityProviderParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *UpdateTenantIdentityProviderParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/update_tenant_identity_provider_responses.go b/operatorapi/operations/operator_api/update_tenant_identity_provider_responses.go deleted file mode 100644 index e6888dbc1..000000000 --- a/operatorapi/operations/operator_api/update_tenant_identity_provider_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// UpdateTenantIdentityProviderNoContentCode is the HTTP code returned for type UpdateTenantIdentityProviderNoContent -const UpdateTenantIdentityProviderNoContentCode int = 204 - -/* -UpdateTenantIdentityProviderNoContent A successful response. - -swagger:response updateTenantIdentityProviderNoContent -*/ -type UpdateTenantIdentityProviderNoContent struct { -} - -// NewUpdateTenantIdentityProviderNoContent creates UpdateTenantIdentityProviderNoContent with default headers values -func NewUpdateTenantIdentityProviderNoContent() *UpdateTenantIdentityProviderNoContent { - - return &UpdateTenantIdentityProviderNoContent{} -} - -// WriteResponse to the client -func (o *UpdateTenantIdentityProviderNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -UpdateTenantIdentityProviderDefault Generic error response. - -swagger:response updateTenantIdentityProviderDefault -*/ -type UpdateTenantIdentityProviderDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewUpdateTenantIdentityProviderDefault creates UpdateTenantIdentityProviderDefault with default headers values -func NewUpdateTenantIdentityProviderDefault(code int) *UpdateTenantIdentityProviderDefault { - if code <= 0 { - code = 500 - } - - return &UpdateTenantIdentityProviderDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the update tenant identity provider default response -func (o *UpdateTenantIdentityProviderDefault) WithStatusCode(code int) *UpdateTenantIdentityProviderDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the update tenant identity provider default response -func (o *UpdateTenantIdentityProviderDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the update tenant identity provider default response -func (o *UpdateTenantIdentityProviderDefault) WithPayload(payload *models.Error) *UpdateTenantIdentityProviderDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the update tenant identity provider default response -func (o *UpdateTenantIdentityProviderDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *UpdateTenantIdentityProviderDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/update_tenant_identity_provider_urlbuilder.go b/operatorapi/operations/operator_api/update_tenant_identity_provider_urlbuilder.go deleted file mode 100644 index 1dd7a6db8..000000000 --- a/operatorapi/operations/operator_api/update_tenant_identity_provider_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// UpdateTenantIdentityProviderURL generates an URL for the update tenant identity provider operation -type UpdateTenantIdentityProviderURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *UpdateTenantIdentityProviderURL) WithBasePath(bp string) *UpdateTenantIdentityProviderURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *UpdateTenantIdentityProviderURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *UpdateTenantIdentityProviderURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/identity-provider" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on UpdateTenantIdentityProviderURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on UpdateTenantIdentityProviderURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *UpdateTenantIdentityProviderURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *UpdateTenantIdentityProviderURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *UpdateTenantIdentityProviderURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on UpdateTenantIdentityProviderURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on UpdateTenantIdentityProviderURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *UpdateTenantIdentityProviderURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/update_tenant_parameters.go b/operatorapi/operations/operator_api/update_tenant_parameters.go deleted file mode 100644 index 7e03f1a48..000000000 --- a/operatorapi/operations/operator_api/update_tenant_parameters.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewUpdateTenantParams creates a new UpdateTenantParams object -// -// There are no default values defined in the spec. -func NewUpdateTenantParams() UpdateTenantParams { - - return UpdateTenantParams{} -} - -// UpdateTenantParams contains all the bound params for the update tenant operation -// typically these are obtained from a http.Request -// -// swagger:parameters UpdateTenant -type UpdateTenantParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.UpdateTenantRequest - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewUpdateTenantParams() beforehand. -func (o *UpdateTenantParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.UpdateTenantRequest - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *UpdateTenantParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *UpdateTenantParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/update_tenant_responses.go b/operatorapi/operations/operator_api/update_tenant_responses.go deleted file mode 100644 index 31e5a28c9..000000000 --- a/operatorapi/operations/operator_api/update_tenant_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// UpdateTenantCreatedCode is the HTTP code returned for type UpdateTenantCreated -const UpdateTenantCreatedCode int = 201 - -/* -UpdateTenantCreated A successful response. - -swagger:response updateTenantCreated -*/ -type UpdateTenantCreated struct { -} - -// NewUpdateTenantCreated creates UpdateTenantCreated with default headers values -func NewUpdateTenantCreated() *UpdateTenantCreated { - - return &UpdateTenantCreated{} -} - -// WriteResponse to the client -func (o *UpdateTenantCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -/* -UpdateTenantDefault Generic error response. - -swagger:response updateTenantDefault -*/ -type UpdateTenantDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewUpdateTenantDefault creates UpdateTenantDefault with default headers values -func NewUpdateTenantDefault(code int) *UpdateTenantDefault { - if code <= 0 { - code = 500 - } - - return &UpdateTenantDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the update tenant default response -func (o *UpdateTenantDefault) WithStatusCode(code int) *UpdateTenantDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the update tenant default response -func (o *UpdateTenantDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the update tenant default response -func (o *UpdateTenantDefault) WithPayload(payload *models.Error) *UpdateTenantDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the update tenant default response -func (o *UpdateTenantDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *UpdateTenantDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/update_tenant_security.go b/operatorapi/operations/operator_api/update_tenant_security.go deleted file mode 100644 index 55f16c84f..000000000 --- a/operatorapi/operations/operator_api/update_tenant_security.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - - "github.com/minio/console/models" -) - -// UpdateTenantSecurityHandlerFunc turns a function with the right signature into a update tenant security handler -type UpdateTenantSecurityHandlerFunc func(UpdateTenantSecurityParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn UpdateTenantSecurityHandlerFunc) Handle(params UpdateTenantSecurityParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// UpdateTenantSecurityHandler interface for that can handle valid update tenant security params -type UpdateTenantSecurityHandler interface { - Handle(UpdateTenantSecurityParams, *models.Principal) middleware.Responder -} - -// NewUpdateTenantSecurity creates a new http.Handler for the update tenant security operation -func NewUpdateTenantSecurity(ctx *middleware.Context, handler UpdateTenantSecurityHandler) *UpdateTenantSecurity { - return &UpdateTenantSecurity{Context: ctx, Handler: handler} -} - -/* - UpdateTenantSecurity swagger:route POST /namespaces/{namespace}/tenants/{tenant}/security OperatorAPI updateTenantSecurity - -Update Tenant Security -*/ -type UpdateTenantSecurity struct { - Context *middleware.Context - Handler UpdateTenantSecurityHandler -} - -func (o *UpdateTenantSecurity) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewUpdateTenantSecurityParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/operator_api/update_tenant_security_parameters.go b/operatorapi/operations/operator_api/update_tenant_security_parameters.go deleted file mode 100644 index 0ef4c7ef4..000000000 --- a/operatorapi/operations/operator_api/update_tenant_security_parameters.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" - - "github.com/minio/console/models" -) - -// NewUpdateTenantSecurityParams creates a new UpdateTenantSecurityParams object -// -// There are no default values defined in the spec. -func NewUpdateTenantSecurityParams() UpdateTenantSecurityParams { - - return UpdateTenantSecurityParams{} -} - -// UpdateTenantSecurityParams contains all the bound params for the update tenant security operation -// typically these are obtained from a http.Request -// -// swagger:parameters UpdateTenantSecurity -type UpdateTenantSecurityParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.UpdateTenantSecurityRequest - /* - Required: true - In: path - */ - Namespace string - /* - Required: true - In: path - */ - Tenant string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewUpdateTenantSecurityParams() beforehand. -func (o *UpdateTenantSecurityParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.UpdateTenantSecurityRequest - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - - rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") - if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { - res = append(res, err) - } - - rTenant, rhkTenant, _ := route.Params.GetOK("tenant") - if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindNamespace binds and validates parameter Namespace from path. -func (o *UpdateTenantSecurityParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Namespace = raw - - return nil -} - -// bindTenant binds and validates parameter Tenant from path. -func (o *UpdateTenantSecurityParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Tenant = raw - - return nil -} diff --git a/operatorapi/operations/operator_api/update_tenant_security_responses.go b/operatorapi/operations/operator_api/update_tenant_security_responses.go deleted file mode 100644 index 2564b0efe..000000000 --- a/operatorapi/operations/operator_api/update_tenant_security_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// UpdateTenantSecurityNoContentCode is the HTTP code returned for type UpdateTenantSecurityNoContent -const UpdateTenantSecurityNoContentCode int = 204 - -/* -UpdateTenantSecurityNoContent A successful response. - -swagger:response updateTenantSecurityNoContent -*/ -type UpdateTenantSecurityNoContent struct { -} - -// NewUpdateTenantSecurityNoContent creates UpdateTenantSecurityNoContent with default headers values -func NewUpdateTenantSecurityNoContent() *UpdateTenantSecurityNoContent { - - return &UpdateTenantSecurityNoContent{} -} - -// WriteResponse to the client -func (o *UpdateTenantSecurityNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -UpdateTenantSecurityDefault Generic error response. - -swagger:response updateTenantSecurityDefault -*/ -type UpdateTenantSecurityDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewUpdateTenantSecurityDefault creates UpdateTenantSecurityDefault with default headers values -func NewUpdateTenantSecurityDefault(code int) *UpdateTenantSecurityDefault { - if code <= 0 { - code = 500 - } - - return &UpdateTenantSecurityDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the update tenant security default response -func (o *UpdateTenantSecurityDefault) WithStatusCode(code int) *UpdateTenantSecurityDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the update tenant security default response -func (o *UpdateTenantSecurityDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the update tenant security default response -func (o *UpdateTenantSecurityDefault) WithPayload(payload *models.Error) *UpdateTenantSecurityDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the update tenant security default response -func (o *UpdateTenantSecurityDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *UpdateTenantSecurityDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/operator_api/update_tenant_security_urlbuilder.go b/operatorapi/operations/operator_api/update_tenant_security_urlbuilder.go deleted file mode 100644 index 08adfa0ba..000000000 --- a/operatorapi/operations/operator_api/update_tenant_security_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// UpdateTenantSecurityURL generates an URL for the update tenant security operation -type UpdateTenantSecurityURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *UpdateTenantSecurityURL) WithBasePath(bp string) *UpdateTenantSecurityURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *UpdateTenantSecurityURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *UpdateTenantSecurityURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}/security" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on UpdateTenantSecurityURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on UpdateTenantSecurityURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *UpdateTenantSecurityURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *UpdateTenantSecurityURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *UpdateTenantSecurityURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on UpdateTenantSecurityURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on UpdateTenantSecurityURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *UpdateTenantSecurityURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/operator_api/update_tenant_urlbuilder.go b/operatorapi/operations/operator_api/update_tenant_urlbuilder.go deleted file mode 100644 index fe20b0bc0..000000000 --- a/operatorapi/operations/operator_api/update_tenant_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operator_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// UpdateTenantURL generates an URL for the update tenant operation -type UpdateTenantURL struct { - Namespace string - Tenant string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *UpdateTenantURL) WithBasePath(bp string) *UpdateTenantURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *UpdateTenantURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *UpdateTenantURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/namespaces/{namespace}/tenants/{tenant}" - - namespace := o.Namespace - if namespace != "" { - _path = strings.Replace(_path, "{namespace}", namespace, -1) - } else { - return nil, errors.New("namespace is required on UpdateTenantURL") - } - - tenant := o.Tenant - if tenant != "" { - _path = strings.Replace(_path, "{tenant}", tenant, -1) - } else { - return nil, errors.New("tenant is required on UpdateTenantURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *UpdateTenantURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *UpdateTenantURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *UpdateTenantURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on UpdateTenantURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on UpdateTenantURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *UpdateTenantURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operations/user_api/check_min_i_o_version.go b/operatorapi/operations/user_api/check_min_i_o_version.go deleted file mode 100644 index 366e21df2..000000000 --- a/operatorapi/operations/user_api/check_min_i_o_version.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package user_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CheckMinIOVersionHandlerFunc turns a function with the right signature into a check min i o version handler -type CheckMinIOVersionHandlerFunc func(CheckMinIOVersionParams) middleware.Responder - -// Handle executing the request and returning a response -func (fn CheckMinIOVersionHandlerFunc) Handle(params CheckMinIOVersionParams) middleware.Responder { - return fn(params) -} - -// CheckMinIOVersionHandler interface for that can handle valid check min i o version params -type CheckMinIOVersionHandler interface { - Handle(CheckMinIOVersionParams) middleware.Responder -} - -// NewCheckMinIOVersion creates a new http.Handler for the check min i o version operation -func NewCheckMinIOVersion(ctx *middleware.Context, handler CheckMinIOVersionHandler) *CheckMinIOVersion { - return &CheckMinIOVersion{Context: ctx, Handler: handler} -} - -/* - CheckMinIOVersion swagger:route GET /check-version UserAPI checkMinIOVersion - -Checks the current Operator version against the latest -*/ -type CheckMinIOVersion struct { - Context *middleware.Context - Handler CheckMinIOVersionHandler -} - -func (o *CheckMinIOVersion) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCheckMinIOVersionParams() - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operatorapi/operations/user_api/check_min_i_o_version_parameters.go b/operatorapi/operations/user_api/check_min_i_o_version_parameters.go deleted file mode 100644 index 700fa9adc..000000000 --- a/operatorapi/operations/user_api/check_min_i_o_version_parameters.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package user_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewCheckMinIOVersionParams creates a new CheckMinIOVersionParams object -// -// There are no default values defined in the spec. -func NewCheckMinIOVersionParams() CheckMinIOVersionParams { - - return CheckMinIOVersionParams{} -} - -// CheckMinIOVersionParams contains all the bound params for the check min i o version operation -// typically these are obtained from a http.Request -// -// swagger:parameters CheckMinIOVersion” -type CheckMinIOVersionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCheckMinIOVersionParams() beforehand. -func (o *CheckMinIOVersionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operatorapi/operations/user_api/check_min_i_o_version_responses.go b/operatorapi/operations/user_api/check_min_i_o_version_responses.go deleted file mode 100644 index 1d0a31afa..000000000 --- a/operatorapi/operations/user_api/check_min_i_o_version_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package user_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/minio/console/models" -) - -// CheckMinIOVersionOKCode is the HTTP code returned for type CheckMinIOVersionOK -const CheckMinIOVersionOKCode int = 200 - -/* -CheckMinIOVersionOK A successful response. - -swagger:response checkMinIOVersionOK -*/ -type CheckMinIOVersionOK struct { - - /* - In: Body - */ - Payload *models.CheckOperatorVersionResponse `json:"body,omitempty"` -} - -// NewCheckMinIOVersionOK creates CheckMinIOVersionOK with default headers values -func NewCheckMinIOVersionOK() *CheckMinIOVersionOK { - - return &CheckMinIOVersionOK{} -} - -// WithPayload adds the payload to the check min i o version o k response -func (o *CheckMinIOVersionOK) WithPayload(payload *models.CheckOperatorVersionResponse) *CheckMinIOVersionOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the check min i o version o k response -func (o *CheckMinIOVersionOK) SetPayload(payload *models.CheckOperatorVersionResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CheckMinIOVersionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CheckMinIOVersionDefault Generic error response. - -swagger:response checkMinIOVersionDefault -*/ -type CheckMinIOVersionDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCheckMinIOVersionDefault creates CheckMinIOVersionDefault with default headers values -func NewCheckMinIOVersionDefault(code int) *CheckMinIOVersionDefault { - if code <= 0 { - code = 500 - } - - return &CheckMinIOVersionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the check min i o version default response -func (o *CheckMinIOVersionDefault) WithStatusCode(code int) *CheckMinIOVersionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the check min i o version default response -func (o *CheckMinIOVersionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the check min i o version default response -func (o *CheckMinIOVersionDefault) WithPayload(payload *models.Error) *CheckMinIOVersionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the check min i o version default response -func (o *CheckMinIOVersionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CheckMinIOVersionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operatorapi/operations/user_api/check_min_i_o_version_urlbuilder.go b/operatorapi/operations/user_api/check_min_i_o_version_urlbuilder.go deleted file mode 100644 index 36341f40c..000000000 --- a/operatorapi/operations/user_api/check_min_i_o_version_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package user_api - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// CheckMinIOVersionURL generates an URL for the check min i o version operation -type CheckMinIOVersionURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CheckMinIOVersionURL) WithBasePath(bp string) *CheckMinIOVersionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CheckMinIOVersionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CheckMinIOVersionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/check-version" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CheckMinIOVersionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CheckMinIOVersionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CheckMinIOVersionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CheckMinIOVersionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CheckMinIOVersionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CheckMinIOVersionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operatorapi/operator_client.go b/operatorapi/operator_client.go deleted file mode 100644 index 92f6fb50c..000000000 --- a/operatorapi/operator_client.go +++ /dev/null @@ -1,70 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - - miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - operatorClientset "github.com/minio/operator/pkg/client/clientset/versioned" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" -) - -// OperatorClientI interface with all functions to be implemented -// by mock when testing, it should include all OperatorClientI respective api calls -// that are used within this project. -type OperatorClientI interface { - TenantDelete(ctx context.Context, namespace string, instanceName string, options metav1.DeleteOptions) error - TenantGet(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*miniov2.Tenant, error) - TenantPatch(ctx context.Context, namespace string, instanceName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) - TenantUpdate(ctx context.Context, tenant *miniov2.Tenant, opts metav1.UpdateOptions) (*miniov2.Tenant, error) - TenantList(ctx context.Context, namespace string, opts metav1.ListOptions) (*miniov2.TenantList, error) -} - -// Interface implementation -// -// Define the structure of a operator client and define the functions that are actually used -// from the minio operator. -type operatorClient struct { - client *operatorClientset.Clientset -} - -// TenantDelete implements the minio instance delete action from minio operator -func (c *operatorClient) TenantDelete(ctx context.Context, namespace string, instanceName string, options metav1.DeleteOptions) error { - return c.client.MinioV2().Tenants(namespace).Delete(ctx, instanceName, options) -} - -// TenantGet implements the minio instance get action from minio operator -func (c *operatorClient) TenantGet(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return c.client.MinioV2().Tenants(namespace).Get(ctx, instanceName, options) -} - -// TenantPatch implements the minio instance patch action from minio operator -func (c *operatorClient) TenantPatch(ctx context.Context, namespace string, instanceName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) { - return c.client.MinioV2().Tenants(namespace).Patch(ctx, instanceName, pt, data, options) -} - -// TenantUpdate implements the minio instance patch action from minio operator -func (c *operatorClient) TenantUpdate(ctx context.Context, tenant *miniov2.Tenant, options metav1.UpdateOptions) (*miniov2.Tenant, error) { - return c.client.MinioV2().Tenants(tenant.Namespace).Update(ctx, tenant, options) -} - -// TenantList implements the minio instance list action from minio operator -func (c *operatorClient) TenantList(ctx context.Context, namespace string, opts metav1.ListOptions) (*miniov2.TenantList, error) { - return c.client.MinioV2().Tenants(namespace).List(ctx, opts) -} diff --git a/operatorapi/operator_subnet.go b/operatorapi/operator_subnet.go deleted file mode 100644 index d72be06c4..000000000 --- a/operatorapi/operator_subnet.go +++ /dev/null @@ -1,203 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2022 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "errors" - "os" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/cluster" - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations" - "github.com/minio/console/operatorapi/operations/operator_api" - xhttp "github.com/minio/console/pkg/http" - "github.com/minio/console/pkg/subnet" - "github.com/minio/console/restapi" - v2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -var ( - apiKeySecretDefault = "operator-subnet" - apiKeySecretEnvVar = "API_KEY_SECRET_NAME" -) - -func registerOperatorSubnetHandlers(api *operations.OperatorAPI) { - api.OperatorAPIOperatorSubnetLoginHandler = operator_api.OperatorSubnetLoginHandlerFunc(func(params operator_api.OperatorSubnetLoginParams, session *models.Principal) middleware.Responder { - res, err := getOperatorSubnetLoginResponse(session, params) - if err != nil { - return operator_api.NewOperatorSubnetLoginDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewOperatorSubnetLoginOK().WithPayload(res) - }) - - api.OperatorAPIOperatorSubnetLoginMFAHandler = operator_api.OperatorSubnetLoginMFAHandlerFunc(func(params operator_api.OperatorSubnetLoginMFAParams, session *models.Principal) middleware.Responder { - res, err := getOperatorSubnetLoginMFAResponse(session, params) - if err != nil { - return operator_api.NewOperatorSubnetLoginMFADefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewOperatorSubnetLoginMFAOK().WithPayload(res) - }) - - api.OperatorAPIOperatorSubnetAPIKeyHandler = operator_api.OperatorSubnetAPIKeyHandlerFunc(func(params operator_api.OperatorSubnetAPIKeyParams, session *models.Principal) middleware.Responder { - res, err := getOperatorSubnetAPIKeyResponse(session, params) - if err != nil { - return operator_api.NewOperatorSubnetAPIKeyDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewOperatorSubnetAPIKeyOK().WithPayload(res) - }) - - api.OperatorAPIOperatorSubnetRegisterAPIKeyHandler = operator_api.OperatorSubnetRegisterAPIKeyHandlerFunc(func(params operator_api.OperatorSubnetRegisterAPIKeyParams, session *models.Principal) middleware.Responder { - res, err := getOperatorSubnetRegisterAPIKeyResponse(session, params) - if err != nil { - return operator_api.NewOperatorSubnetRegisterAPIKeyDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewOperatorSubnetRegisterAPIKeyOK().WithPayload(res) - }) - api.OperatorAPIOperatorSubnetAPIKeyInfoHandler = operator_api.OperatorSubnetAPIKeyInfoHandlerFunc(func(params operator_api.OperatorSubnetAPIKeyInfoParams, session *models.Principal) middleware.Responder { - res, err := getOperatorSubnetAPIKeyInfoResponse(session, params) - if err != nil { - return operator_api.NewOperatorSubnetAPIKeyInfoDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewOperatorSubnetAPIKeyInfoOK().WithPayload(res) - }) -} - -func getOperatorSubnetLoginResponse(session *models.Principal, params operator_api.OperatorSubnetLoginParams) (*models.OperatorSubnetLoginResponse, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - username := params.Body.Username - password := params.Body.Password - if username == "" || password == "" { - return nil, restapi.ErrorWithContext(ctx, errors.New("empty credentials")) - } - subnetHTTPClient := &xhttp.Client{Client: restapi.GetConsoleHTTPClient("")} - token, mfa, err := restapi.SubnetLogin(subnetHTTPClient, username, password) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - return &models.OperatorSubnetLoginResponse{ - AccessToken: token, - MfaToken: mfa, - }, nil -} - -func getOperatorSubnetLoginMFAResponse(session *models.Principal, params operator_api.OperatorSubnetLoginMFAParams) (*models.OperatorSubnetLoginResponse, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - subnetHTTPClient := &xhttp.Client{Client: restapi.GetConsoleHTTPClient("")} - res, err := subnet.LoginWithMFA(subnetHTTPClient, *params.Body.Username, *params.Body.MfaToken, *params.Body.Otp) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - return &models.OperatorSubnetLoginResponse{ - AccessToken: res.AccessToken, - }, nil -} - -func getOperatorSubnetAPIKeyResponse(session *models.Principal, params operator_api.OperatorSubnetAPIKeyParams) (*models.OperatorSubnetAPIKey, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - subnetHTTPClient := &xhttp.Client{Client: restapi.GetConsoleHTTPClient("")} - token := params.HTTPRequest.URL.Query().Get("token") - apiKey, err := subnet.GetAPIKey(subnetHTTPClient, token) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - return &models.OperatorSubnetAPIKey{APIKey: apiKey}, nil -} - -func getOperatorSubnetRegisterAPIKeyResponse(session *models.Principal, params operator_api.OperatorSubnetRegisterAPIKeyParams) (*models.OperatorSubnetRegisterAPIKeyResponse, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - clientSet, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - tenants, err := getTenantsToRegister(ctx, session) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - k8sClient := &k8sClient{client: clientSet} - return registerTenants(ctx, tenants.Items, params.Body.APIKey, k8sClient) -} - -func getTenantsToRegister(ctx context.Context, session *models.Principal) (*v2.TenantList, error) { - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return nil, err - } - opClient := &operatorClient{client: opClientClientSet} - return opClient.TenantList(ctx, "", metav1.ListOptions{}) -} - -func registerTenants(ctx context.Context, tenants []v2.Tenant, apiKey string, k8sClient K8sClientI) (*models.OperatorSubnetRegisterAPIKeyResponse, *models.Error) { - for _, tenant := range tenants { - if err := registerTenant(ctx, tenant, apiKey, k8sClient); err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - } - if err := createSubnetAPIKeySecret(ctx, apiKey, k8sClient); err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - return &models.OperatorSubnetRegisterAPIKeyResponse{Registered: true}, nil -} - -func registerTenant(ctx context.Context, tenant v2.Tenant, apiKey string, k8sClient K8sClientI) error { - svcURL := tenant.GetTenantServiceURL() - mAdmin, err := getTenantAdminClient(ctx, k8sClient, &tenant, svcURL) - if err != nil { - return err - } - adminClient := restapi.AdminClient{Client: mAdmin} - _, err = restapi.SubnetRegisterWithAPIKey(ctx, adminClient, apiKey) - return err -} - -func createSubnetAPIKeySecret(ctx context.Context, apiKey string, k8sClient K8sClientI) error { - apiKeySecret := &corev1.Secret{ - ObjectMeta: metav1.ObjectMeta{Name: getAPIKeySecretName()}, - Type: corev1.SecretTypeOpaque, - Data: map[string][]byte{"api-key": []byte(apiKey)}, - } - _, err := k8sClient.createSecret(ctx, "default", apiKeySecret, metav1.CreateOptions{}) - return err -} - -func getOperatorSubnetAPIKeyInfoResponse(session *models.Principal, params operator_api.OperatorSubnetAPIKeyInfoParams) (*models.OperatorSubnetRegisterAPIKeyResponse, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - clientSet, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - k8sClient := &k8sClient{client: clientSet} - if _, err := k8sClient.getSecret(ctx, "default", getAPIKeySecretName(), metav1.GetOptions{}); err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - return &models.OperatorSubnetRegisterAPIKeyResponse{Registered: true}, nil -} - -func getAPIKeySecretName() string { - if s := os.Getenv(apiKeySecretEnvVar); s != "" { - return s - } - return apiKeySecretDefault -} diff --git a/operatorapi/operator_subnet_test.go b/operatorapi/operator_subnet_test.go deleted file mode 100644 index bb975e608..000000000 --- a/operatorapi/operator_subnet_test.go +++ /dev/null @@ -1,304 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2022 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "fmt" - "net/http" - "net/http/httptest" - "net/url" - "os" - "testing" - - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations" - "github.com/minio/console/operatorapi/operations/operator_api" - "github.com/minio/console/pkg/subnet" - v2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/suite" - corev1 "k8s.io/api/core/v1" - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -type OperatorSubnetTestSuite struct { - suite.Suite - assert *assert.Assertions - loginServer *httptest.Server - loginWithError bool - loginMFAServer *httptest.Server - loginMFAWithError bool - getAPIKeyServer *httptest.Server - getAPIKeyWithError bool - registerAPIKeyServer *httptest.Server - registerAPIKeyWithError bool - k8sClient k8sClientMock -} - -func (suite *OperatorSubnetTestSuite) SetupSuite() { - suite.assert = assert.New(suite.T()) - suite.loginServer = httptest.NewServer(http.HandlerFunc(suite.loginHandler)) - suite.loginMFAServer = httptest.NewServer(http.HandlerFunc(suite.loginMFAHandler)) - suite.getAPIKeyServer = httptest.NewServer(http.HandlerFunc(suite.getAPIKeyHandler)) - suite.registerAPIKeyServer = httptest.NewServer(http.HandlerFunc(suite.registerAPIKeyHandler)) - suite.k8sClient = k8sClientMock{} - k8sClientCreateSecretMock = func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) { - return &corev1.Secret{}, nil - } - k8sclientGetSecretMock = func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - data := make(map[string][]byte) - data["secretkey"] = []byte("secret") - data["accesskey"] = []byte("access") - sec := &corev1.Secret{ - Data: data, - } - return sec, nil - } -} - -func (suite *OperatorSubnetTestSuite) loginHandler( - w http.ResponseWriter, r *http.Request, -) { - if suite.loginWithError { - w.WriteHeader(400) - } else { - fmt.Fprintf(w, `{"mfa_required": true, "mfa_token": "mockToken"}`) - } -} - -func (suite *OperatorSubnetTestSuite) loginMFAHandler( - w http.ResponseWriter, r *http.Request, -) { - if suite.loginMFAWithError { - w.WriteHeader(400) - } else { - fmt.Fprintf(w, `{"token_info": {"access_token": "mockToken"}}`) - } -} - -func (suite *OperatorSubnetTestSuite) getAPIKeyHandler( - w http.ResponseWriter, r *http.Request, -) { - if suite.getAPIKeyWithError { - w.WriteHeader(400) - } else { - fmt.Fprintf(w, `{"api_key": "mockAPIKey"}`) - } -} - -func (suite *OperatorSubnetTestSuite) registerAPIKeyHandler( - w http.ResponseWriter, r *http.Request, -) { - if suite.registerAPIKeyWithError { - w.WriteHeader(400) - } else { - fmt.Fprintf(w, `{"api_key": "mockAPIKey"}`) - } -} - -func (suite *OperatorSubnetTestSuite) TearDownSuite() { -} - -func (suite *OperatorSubnetTestSuite) TestRegisterOperatorSubnetHanlders() { - api := &operations.OperatorAPI{} - suite.assert.Nil(api.OperatorAPIOperatorSubnetLoginHandler) - suite.assert.Nil(api.OperatorAPIOperatorSubnetLoginMFAHandler) - suite.assert.Nil(api.OperatorAPIOperatorSubnetAPIKeyHandler) - suite.assert.Nil(api.OperatorAPIOperatorSubnetRegisterAPIKeyHandler) - registerOperatorSubnetHandlers(api) - suite.assert.NotNil(api.OperatorAPIOperatorSubnetLoginHandler) - suite.assert.NotNil(api.OperatorAPIOperatorSubnetLoginMFAHandler) - suite.assert.NotNil(api.OperatorAPIOperatorSubnetAPIKeyHandler) - suite.assert.NotNil(api.OperatorAPIOperatorSubnetRegisterAPIKeyHandler) -} - -func (suite *OperatorSubnetTestSuite) TestOperatorSubnetLoginHandlerWithEmptyCredentials() { - params, api := suite.initSubnetLoginRequest("", "") - response := api.OperatorAPIOperatorSubnetLoginHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.OperatorSubnetLoginDefault) - suite.assert.True(ok) -} - -func (suite *OperatorSubnetTestSuite) TestOperatorSubnetLoginHandlerWithServerError() { - params, api := suite.initSubnetLoginRequest("mockusername", "mockpassword") - suite.loginWithError = true - os.Setenv(subnet.ConsoleSubnetURL, suite.loginServer.URL) - response := api.OperatorAPIOperatorSubnetLoginHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.OperatorSubnetLoginDefault) - suite.assert.True(ok) - os.Unsetenv(subnet.ConsoleSubnetURL) -} - -func (suite *OperatorSubnetTestSuite) TestOperatorSubnetLoginHandlerWithoutError() { - params, api := suite.initSubnetLoginRequest("mockusername", "mockpassword") - suite.loginWithError = false - os.Setenv(subnet.ConsoleSubnetURL, suite.loginServer.URL) - response := api.OperatorAPIOperatorSubnetLoginHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.OperatorSubnetLoginOK) - suite.assert.True(ok) - os.Unsetenv(subnet.ConsoleSubnetURL) -} - -func (suite *OperatorSubnetTestSuite) initSubnetLoginRequest(username, password string) (params operator_api.OperatorSubnetLoginParams, api operations.OperatorAPI) { - registerOperatorSubnetHandlers(&api) - params.Body = &models.OperatorSubnetLoginRequest{Username: username, Password: password} - params.HTTPRequest = &http.Request{} - return params, api -} - -func (suite *OperatorSubnetTestSuite) TestOperatorSubnetLoginMFAHandlerWithServerError() { - params, api := suite.initSubnetLoginMFARequest("mockusername", "mockMFA", "mockOTP") - suite.loginMFAWithError = true - os.Setenv(subnet.ConsoleSubnetURL, suite.loginMFAServer.URL) - response := api.OperatorAPIOperatorSubnetLoginMFAHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.OperatorSubnetLoginMFADefault) - suite.assert.True(ok) - os.Unsetenv(subnet.ConsoleSubnetURL) -} - -func (suite *OperatorSubnetTestSuite) TestOperatorSubnetLoginMFAHandlerWithoutError() { - params, api := suite.initSubnetLoginMFARequest("mockusername", "mockMFA", "mockOTP") - suite.loginMFAWithError = false - os.Setenv(subnet.ConsoleSubnetURL, suite.loginMFAServer.URL) - response := api.OperatorAPIOperatorSubnetLoginMFAHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.OperatorSubnetLoginMFAOK) - suite.assert.True(ok) - os.Unsetenv(subnet.ConsoleSubnetURL) -} - -func (suite *OperatorSubnetTestSuite) initSubnetLoginMFARequest(username, mfa, otp string) (params operator_api.OperatorSubnetLoginMFAParams, api operations.OperatorAPI) { - registerOperatorSubnetHandlers(&api) - params.Body = &models.OperatorSubnetLoginMFARequest{Username: &username, MfaToken: &mfa, Otp: &otp} - params.HTTPRequest = &http.Request{} - return params, api -} - -func (suite *OperatorSubnetTestSuite) TestOperatorSubnetAPIKeyHandlerWithServerError() { - params, api := suite.initSubnetAPIKeyRequest() - suite.getAPIKeyWithError = true - os.Setenv(subnet.ConsoleSubnetURL, suite.getAPIKeyServer.URL) - response := api.OperatorAPIOperatorSubnetAPIKeyHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.OperatorSubnetAPIKeyDefault) - suite.assert.True(ok) - os.Unsetenv(subnet.ConsoleSubnetURL) -} - -func (suite *OperatorSubnetTestSuite) TestOperatorSubnetAPIKeyHandlerWithoutError() { - params, api := suite.initSubnetAPIKeyRequest() - suite.getAPIKeyWithError = false - os.Setenv(subnet.ConsoleSubnetURL, suite.getAPIKeyServer.URL) - response := api.OperatorAPIOperatorSubnetAPIKeyHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.OperatorSubnetAPIKeyOK) - suite.assert.True(ok) - os.Unsetenv(subnet.ConsoleSubnetURL) -} - -func (suite *OperatorSubnetTestSuite) initSubnetAPIKeyRequest() (params operator_api.OperatorSubnetAPIKeyParams, api operations.OperatorAPI) { - registerOperatorSubnetHandlers(&api) - params.HTTPRequest = &http.Request{URL: &url.URL{}} - return params, api -} - -// TODO: Improve register tests (make code more testable) -// func (suite *OperatorSubnetTestSuite) TestOperatorSubnetRegisterAPIKeyHandlerWithServerError() { -// params, api := suite.initSubnetRegisterAPIKeyRequest() -// suite.registerAPIKeyWithError = true -// os.Setenv(subnet.ConsoleSubnetURL, suite.registerAPIKeyServer.URL) -// response := api.OperatorAPIOperatorSubnetRegisterAPIKeyHandler.Handle(params, &models.Principal{}) -// _, ok := response.(*operator_api.OperatorSubnetRegisterAPIKeyDefault) -// suite.assert.True(ok) -// os.Unsetenv(subnet.ConsoleSubnetURL) -// } - -// func (suite *OperatorSubnetTestSuite) TestOperatorSubnetRegisterAPIKeyHandlerWithError() { -// ctx := context.Background() -// suite.registerAPIKeyWithError = false -// os.Setenv(subnet.ConsoleSubnetURL, suite.registerAPIKeyServer.URL) -// res, err := registerTenants([]v2.Tenant{{ -// Spec: v2.TenantSpec{CredsSecret: &corev1.LocalObjectReference{Name: "secret-name"}}, -// }}, "mockAPIKey", ctx, suite.k8sClient) -// suite.assert.Nil(res) -// suite.assert.NotNil(err) -// os.Unsetenv(subnet.ConsoleSubnetURL) -// } - -// func (suite *OperatorSubnetTestSuite) TestOperatorSubnetRegisterAPIKeyHandlerGetTenants() { -// ctx := context.Background() -// res, err := getTenantsToRegister(ctx, &models.Principal{}) -// suite.assert.NotNil(res) -// suite.assert.Nil(err) -// } - -func (suite *OperatorSubnetTestSuite) TestOperatorSubnetRegisterAPIKeyHandlerWithUnreachableTenant() { - ctx := context.Background() - res, err := registerTenants(ctx, []v2.Tenant{{ - Spec: v2.TenantSpec{CredsSecret: &corev1.LocalObjectReference{Name: "secret-name"}}, - }}, "mockAPIKey", suite.k8sClient) - suite.assert.Nil(res) - suite.assert.NotNil(err) -} - -func (suite *OperatorSubnetTestSuite) TestOperatorSubnetRegisterAPIKeyHandlerZeroTenants() { - ctx := context.Background() - res, err := registerTenants(ctx, []v2.Tenant{}, "mockAPIKey", suite.k8sClient) - suite.assert.NotNil(res) - suite.assert.Nil(err) -} - -// func (suite *OperatorSubnetTestSuite) initSubnetRegisterAPIKeyRequest() (params operator_api.OperatorSubnetRegisterAPIKeyParams, api operations.OperatorAPI) { -// registerOperatorSubnetHandlers(&api) -// params.Body = &models.OperatorSubnetAPIKey{APIKey: "mockAPIKey"} -// params.HTTPRequest = &http.Request{} -// return params, api -// } - -func (suite *OperatorSubnetTestSuite) TestOperatorSubnetAPIKeyInfoHandlerWithNoSecret() { - params, api := suite.initSubnetAPIKeyInfoRequest() - os.Setenv(apiKeySecretEnvVar, "mock-operator-subnet") - response := api.OperatorAPIOperatorSubnetAPIKeyInfoHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.OperatorSubnetAPIKeyInfoDefault) - suite.assert.True(ok) - os.Unsetenv(apiKeySecretEnvVar) -} - -// func (suite *OperatorSubnetTestSuite) TestOperatorSubnetAPIKeyInfoHandlerWithSecret() { -// params, api := suite.initSubnetAPIKeyInfoRequest() -// os.Setenv(apiKeySecretEnvVar, "mock-operator-subnet") -// session := &models.Principal{} -// clientSet, _ := cluster.K8sClient(session.STSSessionToken) -// k8sClient := &k8sClient{client: clientSet} -// ctx := context.Background() -// secret := &corev1.Secret{ObjectMeta: metav1.ObjectMeta{Name: getAPIKeySecretName()}} -// k8sClient.createSecret(ctx, "default", secret, metav1.CreateOptions{}) -// response := api.OperatorAPIOperatorSubnetAPIKeyInfoHandler.Handle(params, session) -// _, ok := response.(*operator_api.OperatorSubnetAPIKeyInfoOK) -// suite.assert.True(ok) -// k8sClient.deleteSecret(ctx, "default", getAPIKeySecretName(), metav1.DeleteOptions{}) -// os.Unsetenv(apiKeySecretEnvVar) -// } - -func (suite *OperatorSubnetTestSuite) initSubnetAPIKeyInfoRequest() (params operator_api.OperatorSubnetAPIKeyInfoParams, api operations.OperatorAPI) { - registerOperatorSubnetHandlers(&api) - params.HTTPRequest = &http.Request{} - return params, api -} - -func TestOperatorSubnet(t *testing.T) { - suite.Run(t, new(OperatorSubnetTestSuite)) -} diff --git a/operatorapi/parity.go b/operatorapi/parity.go deleted file mode 100644 index 98da00d0a..000000000 --- a/operatorapi/parity.go +++ /dev/null @@ -1,63 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "fmt" - - errors "github.com/minio/console/restapi" - - "github.com/minio/console/pkg/utils" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations" - "github.com/minio/console/operatorapi/operations/operator_api" -) - -func registerParityHandlers(api *operations.OperatorAPI) { - api.OperatorAPIGetParityHandler = operator_api.GetParityHandlerFunc(func(params operator_api.GetParityParams, principal *models.Principal) middleware.Responder { - resp, err := getParityResponse(params) - if err != nil { - return operator_api.NewGetParityDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewGetParityOK().WithPayload(resp) - }) -} - -func GetParityInfo(nodes int64, disksPerNode int64) (models.ParityResponse, error) { - parityVals, err := utils.PossibleParityValues(fmt.Sprintf(`http://minio{1...%d}/export/set{1...%d}`, nodes, disksPerNode)) - if err != nil { - return nil, err - } - - return parityVals, nil -} - -func getParityResponse(params operator_api.GetParityParams) (models.ParityResponse, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - nodes := params.Nodes - disksPerNode := params.DisksPerNode - parityValues, err := GetParityInfo(nodes, disksPerNode) - if err != nil { - errors.LogError("error getting parity info: %v", err) - return nil, errors.ErrorWithContext(ctx, err) - } - return parityValues, nil -} diff --git a/operatorapi/parity_test.go b/operatorapi/parity_test.go deleted file mode 100644 index 04802c330..000000000 --- a/operatorapi/parity_test.go +++ /dev/null @@ -1,131 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "encoding/json" - "net/http" - "reflect" - "testing" - - "github.com/minio/console/operatorapi/operations/operator_api" - "github.com/stretchr/testify/assert" - - "github.com/minio/console/models" -) - -func Test_getParityInfo(t *testing.T) { - tests := []struct { - description string - wantErr bool - nodes int64 - disksPerNode int64 - expectedResp models.ParityResponse - }{ - { - description: "Incorrect Number of endpoints provided", - wantErr: true, - nodes: 1, - disksPerNode: 1, - expectedResp: nil, - }, - { - description: "Number of endpoints is valid", - wantErr: false, - nodes: 4, - disksPerNode: 10, - expectedResp: models.ParityResponse{"EC:4", "EC:3", "EC:2"}, - }, - { - description: "More nodes than disks", - wantErr: false, - nodes: 4, - disksPerNode: 1, - expectedResp: models.ParityResponse{"EC:2"}, - }, - { - description: "More disks than nodes", - wantErr: false, - nodes: 2, - disksPerNode: 50, - expectedResp: models.ParityResponse{"EC:5", "EC:4", "EC:3", "EC:2"}, - }, - } - - for _, tt := range tests { - t.Run(tt.description, func(t *testing.T) { - parity, err := GetParityInfo(tt.nodes, tt.disksPerNode) - if (err != nil) != tt.wantErr { - t.Errorf("GetParityInfo() error = %v, wantErr %v", err, tt.wantErr) - } - - if !reflect.DeepEqual(parity, tt.expectedResp) { - ji, _ := json.Marshal(parity) - vi, _ := json.Marshal(tt.expectedResp) - t.Errorf("\ngot: %s \nwant: %s", ji, vi) - } - }) - } -} - -func Test_getParityResponse(t *testing.T) { - type args struct { - params operator_api.GetParityParams - } - tests := []struct { - name string - args args - want models.ParityResponse - wantErr bool - }{ - { - name: "valid", - args: args{ - params: operator_api.GetParityParams{ - HTTPRequest: &http.Request{}, - DisksPerNode: 4, - Nodes: 4, - }, - }, - want: models.ParityResponse{"EC:8", "EC:7", "EC:6", "EC:5", "EC:4", "EC:3", "EC:2"}, - wantErr: false, - }, - { - name: "invalid", - args: args{ - params: operator_api.GetParityParams{ - HTTPRequest: &http.Request{}, - DisksPerNode: -4, - Nodes: 4, - }, - }, - want: models.ParityResponse(nil), - wantErr: true, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, got1 := getParityResponse(tt.args.params) - assert.Equalf(t, tt.want, got, "getParityResponse(%v)", tt.args.params) - if tt.wantErr { - assert.NotNilf(t, got1, "getParityResponse(%v)", tt.args.params) - } else { - assert.Nilf(t, got1, "getParityResponse(%v)", tt.args.params) - } - }) - } -} diff --git a/operatorapi/proxy.go b/operatorapi/proxy.go deleted file mode 100644 index 8d4ea4c93..000000000 --- a/operatorapi/proxy.go +++ /dev/null @@ -1,341 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "bytes" - "crypto/sha1" - "encoding/json" - "errors" - "fmt" - "io" - "log" - "net/http" - "net/http/cookiejar" - url2 "net/url" - "strings" - "time" - - "github.com/minio/websocket" - - v2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "github.com/minio/console/cluster" - "github.com/minio/console/restapi" - - "github.com/minio/console/pkg/auth" -) - -func serveProxy(responseWriter http.ResponseWriter, req *http.Request) { - urlParts := strings.Split(req.URL.Path, "/") - // Either proxy or hop, will decide the type of session - proxyMethod := urlParts[2] - - if len(urlParts) < 5 { - log.Println(len(urlParts)) - return - } - namespace := urlParts[3] - tenantName := urlParts[4] - - // validate the tenantName - - token, err := auth.GetTokenFromRequest(req) - if err != nil { - log.Println(err) - responseWriter.WriteHeader(401) - return - } - claims, err := auth.SessionTokenAuthenticate(token) - if err != nil { - log.Printf("Unable to validate the session token %s: %v\n", token, err) - responseWriter.WriteHeader(401) - - return - } - - STSSessionToken := claims.STSSessionToken - - opClientClientSet, err := cluster.OperatorClient(STSSessionToken) - if err != nil { - log.Println(err) - responseWriter.WriteHeader(404) - return - } - opClient := operatorClient{ - client: opClientClientSet, - } - tenant, err := opClient.TenantGet(req.Context(), namespace, tenantName, metav1.GetOptions{}) - if err != nil { - log.Println(err) - responseWriter.WriteHeader(502) - return - } - - nsTenant := fmt.Sprintf("%s/%s", tenant.Namespace, tenant.Name) - - tenantSchema := "http" - tenantPort := fmt.Sprintf(":%d", v2.ConsolePort) - if tenant.AutoCert() || tenant.ExternalCert() { - tenantSchema = "https" - tenantPort = fmt.Sprintf(":%d", v2.ConsoleTLSPort) - } - - tenantURL := fmt.Sprintf("%s://%s.%s.svc.%s%s", tenantSchema, tenant.ConsoleCIServiceName(), tenant.Namespace, v2.GetClusterDomain(), tenantPort) - // for development - // tenantURL = "http://localhost:9091" - // tenantURL = "https://localhost:9443" - - h := sha1.New() - h.Write([]byte(nsTenant)) - tenantCookieName := fmt.Sprintf("token-%s-%s-%x", proxyMethod, claims.AccountAccessKey, string(h.Sum(nil))) - tenantCookie, err := req.Cookie(tenantCookieName) - if err != nil { - // login to tenantName - loginURL := fmt.Sprintf("%s/api/v1/login", tenantURL) - - // get the tenant credentials - clientSet, err := cluster.K8sClient(STSSessionToken) - if err != nil { - log.Println(err) - responseWriter.WriteHeader(500) - return - } - - k8sClient := k8sClient{ - client: clientSet, - } - tenantConfiguration, err := GetTenantConfiguration(req.Context(), &k8sClient, tenant) - if err != nil { - log.Println(err) - responseWriter.WriteHeader(500) - return - } - - data := map[string]interface{}{ - "accessKey": tenantConfiguration["accesskey"], - "secretKey": tenantConfiguration["secretkey"], - } - // if this a proxy request hide the menu - if proxyMethod == "proxy" { - data["features"] = map[string]bool{ - "hide_menu": true, - } - } - payload, _ := json.Marshal(data) - - loginReq, err := http.NewRequest(http.MethodPost, loginURL, bytes.NewReader(payload)) - if err != nil { - log.Println(err) - responseWriter.WriteHeader(500) - return - } - loginReq.Header.Add("Content-Type", "application/json") - - // use localhost to ensure 'InsecureSkipVerify' - client := restapi.GetConsoleHTTPClient("http://127.0.0.1") - loginResp, err := client.Do(loginReq) - if err != nil { - log.Println(err) - responseWriter.WriteHeader(500) - return - } - - if loginResp.StatusCode < 200 && loginResp.StatusCode <= 299 { - log.Println(fmt.Printf("Status: %d. Couldn't complete login", loginResp.StatusCode)) - responseWriter.WriteHeader(500) - return - } - - for _, c := range loginResp.Cookies() { - if c.Name == "token" { - tenantCookie = c - c := &http.Cookie{ - Name: tenantCookieName, - Value: c.Value, - Path: c.Path, - Expires: c.Expires, - HttpOnly: c.HttpOnly, - } - - http.SetCookie(responseWriter, c) - break - } - } - defer loginResp.Body.Close() - } - - if tenantCookie == nil { - log.Println(errors.New("couldn't login to tenant and get cookie")) - responseWriter.WriteHeader(403) - return - } - // at this point we have a valid cookie ready to either route HTTP or WS - // now we need to know if we are doing an /api/ call (http) or /ws/ call (ws) - callType := urlParts[5] - - targetURL, err := url2.Parse(tenantURL) - if err != nil { - log.Println(err) - responseWriter.WriteHeader(500) - return - } - tenantBase := fmt.Sprintf("/api/%s/%s/%s", proxyMethod, tenant.Namespace, tenant.Name) - targetURL.Path = strings.ReplaceAll(req.URL.Path, tenantBase, "") - - proxiedCookie := &http.Cookie{ - Name: "token", - Value: tenantCookie.Value, - Path: tenantCookie.Path, - Expires: tenantCookie.Expires, - HttpOnly: tenantCookie.HttpOnly, - } - - proxyCookieJar, _ := cookiejar.New(nil) - proxyCookieJar.SetCookies(targetURL, []*http.Cookie{proxiedCookie}) - switch callType { - case "ws": - handleWSRequest(responseWriter, req, proxyCookieJar, targetURL, tenantSchema) - default: - handleHTTPRequest(responseWriter, req, proxyCookieJar, tenantBase, targetURL) - } -} - -func handleHTTPRequest(responseWriter http.ResponseWriter, req *http.Request, proxyCookieJar *cookiejar.Jar, tenantBase string, targetURL *url2.URL) { - // use localhost to ensure 'InsecureSkipVerify' - client := restapi.GetConsoleHTTPClient("http://127.0.0.1") - client.Jar = proxyCookieJar - client.CheckRedirect = func(req *http.Request, via []*http.Request) error { - return http.ErrUseLastResponse - } - - // are we proxying something with cp=y? (console proxy) then add cpb (console proxy base) so the console - // on the other side updates the to this value overriding sub path or root - if v := req.URL.Query().Get("cp"); v == "y" { - q := req.URL.Query() - q.Add("cpb", tenantBase) - req.URL.RawQuery = q.Encode() - } - // copy query params - targetURL.RawQuery = req.URL.Query().Encode() - - proxRequest, err := http.NewRequest(req.Method, targetURL.String(), req.Body) - if err != nil { - log.Println(err) - responseWriter.WriteHeader(500) - return - } - - for _, v := range req.Header.Values("Content-Type") { - proxRequest.Header.Add("Content-Type", v) - } - - resp, err := client.Do(proxRequest) - if err != nil { - log.Println(err) - responseWriter.WriteHeader(500) - return - } - - for hk, hv := range resp.Header { - if hk != "X-Frame-Options" { - for _, v := range hv { - responseWriter.Header().Add(hk, v) - } - } - } - // Allow iframes - responseWriter.Header().Set("X-Frame-Options", "SAMEORIGIN") - responseWriter.Header().Set("X-XSS-Protection", "1; mode=block") - // Pass HTTP status code to proxy response - responseWriter.WriteHeader(resp.StatusCode) - - io.Copy(responseWriter, resp.Body) -} - -var upgrader = websocket.Upgrader{ - ReadBufferSize: 0, - WriteBufferSize: 1024, -} - -func handleWSRequest(responseWriter http.ResponseWriter, req *http.Request, proxyCookieJar *cookiejar.Jar, targetURL *url2.URL, schema string) { - dialer := &websocket.Dialer{ - Proxy: http.ProxyFromEnvironment, - HandshakeTimeout: 45 * time.Second, - Jar: proxyCookieJar, - } - - upgrader.CheckOrigin = func(r *http.Request) bool { - return true - } - - c, err := upgrader.Upgrade(responseWriter, req, nil) - if err != nil { - log.Print("error upgrade connection:", err) - return - } - defer c.Close() - if schema == "http" { - targetURL.Scheme = "ws" - } else { - targetURL.Scheme = "wss" - } - - // establish a websocket to the tenant - tenantConn, _, err := dialer.Dial(targetURL.String(), nil) - if err != nil { - log.Println("dial:", err) - return - } - defer tenantConn.Close() - - doneTenant := make(chan struct{}) - done := make(chan struct{}) - - // start read pump from tenant connection - go func() { - defer close(doneTenant) - for { - msgType, message, err := tenantConn.ReadMessage() - if err != nil { - log.Println("error read from tenant:", err) - return - } - c.WriteMessage(msgType, message) - } - }() - - // start read pump from tenant connection - go func() { - defer close(done) - for { - msgType, message, err := c.ReadMessage() - if err != nil { - log.Println("error read from client:", err) - return - } - tenantConn.WriteMessage(msgType, message) - } - }() - - select { - case <-done: - case <-doneTenant: - } -} diff --git a/operatorapi/resource_quota.go b/operatorapi/resource_quota.go deleted file mode 100644 index 68edec458..000000000 --- a/operatorapi/resource_quota.go +++ /dev/null @@ -1,112 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "fmt" - - xerrors "github.com/minio/console/restapi" - - "k8s.io/apimachinery/pkg/api/errors" - - "github.com/minio/console/cluster" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations" - "github.com/minio/console/operatorapi/operations/operator_api" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func registerResourceQuotaHandlers(api *operations.OperatorAPI) { - // Get Resource Quota - api.OperatorAPIGetResourceQuotaHandler = operator_api.GetResourceQuotaHandlerFunc(func(params operator_api.GetResourceQuotaParams, session *models.Principal) middleware.Responder { - resp, err := getResourceQuotaResponse(session, params) - if err != nil { - return operator_api.NewGetResourceQuotaDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewGetResourceQuotaOK().WithPayload(resp) - }) -} - -func getResourceQuota(ctx context.Context, client K8sClientI, namespace, resourcequota string) (*models.ResourceQuota, error) { - resourceQuota, err := client.getResourceQuota(ctx, namespace, resourcequota, metav1.GetOptions{}) - if err != nil { - // if there's no resource quotas - if errors.IsNotFound(err) { - // validate if at least the namespace is valid, if it is, return all storage classes with max capacity - _, err := client.getNamespace(ctx, namespace, metav1.GetOptions{}) - if err != nil { - return nil, err - } - storageClasses, err := client.getStorageClasses(ctx, metav1.ListOptions{}) - if err != nil { - return nil, err - } - rq := models.ResourceQuota{Name: resourceQuota.Name} - for _, sc := range storageClasses.Items { - // Create Resource element with hard limit maxed out - name := fmt.Sprintf("%s.storageclass.storage.k8s.io/requests.storage", sc.Name) - element := models.ResourceQuotaElement{ - Name: name, - Hard: 9223372036854775807, - } - rq.Elements = append(rq.Elements, &element) - } - return &rq, nil - } - - return nil, err - } - rq := models.ResourceQuota{Name: resourceQuota.Name} - resourceElementss := make(map[string]models.ResourceQuotaElement) - for name, quantity := range resourceQuota.Status.Hard { - // Create Resource element with hard limit - element := models.ResourceQuotaElement{ - Name: string(name), - Hard: quantity.Value(), - } - resourceElementss[string(name)] = element - } - for name, quantity := range resourceQuota.Status.Used { - // Update resource element with Used quota - if r, ok := resourceElementss[string(name)]; ok { - r.Used = quantity.Value() - // Element will only be returned if it has Hard and Used status - rq.Elements = append(rq.Elements, &r) - } - } - return &rq, nil -} - -func getResourceQuotaResponse(session *models.Principal, params operator_api.GetResourceQuotaParams) (*models.ResourceQuota, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - client, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, xerrors.ErrorWithContext(ctx, err) - } - k8sClient := &k8sClient{ - client: client, - } - resourceQuota, err := getResourceQuota(ctx, k8sClient, params.Namespace, params.ResourceQuotaName) - if err != nil { - return nil, xerrors.ErrorWithContext(ctx, err) - } - return resourceQuota, nil -} diff --git a/operatorapi/resource_quota_test.go b/operatorapi/resource_quota_test.go deleted file mode 100644 index a0c4dd5a1..000000000 --- a/operatorapi/resource_quota_test.go +++ /dev/null @@ -1,132 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "errors" - "reflect" - "testing" - - "github.com/minio/console/models" - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func Test_ResourceQuota(t *testing.T) { - mockHardResourceQuota := v1.ResourceList{ - "storage": resource.MustParse("1000"), - "cpu": resource.MustParse("2Ki"), - } - mockUsedResourceQuota := v1.ResourceList{ - "storage": resource.MustParse("500"), - "cpu": resource.MustParse("1Ki"), - } - mockRQResponse := v1.ResourceQuota{ - Spec: v1.ResourceQuotaSpec{ - Hard: mockHardResourceQuota, - }, - Status: v1.ResourceQuotaStatus{ - Hard: mockHardResourceQuota, - Used: mockUsedResourceQuota, - }, - } - mockRQResponse.Name = "ResourceQuota1" - // k8sclientGetResourceQuotaMock = func(ctx context.Context, namespace, resource string, opts metav1.GetOptions) (*v1.ResourceQuota, error) { - // return nil, nil - // } - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - kClient := k8sClientMock{} - type args struct { - ctx context.Context - client K8sClientI - } - tests := []struct { - name string - args args - wantErr bool - want models.ResourceQuota - mockResourceQuota func(ctx context.Context, namespace, resource string, opts metav1.GetOptions) (*v1.ResourceQuota, error) - }{ - { - name: "Return resource quota elements", - args: args{ - ctx: ctx, - client: kClient, - }, - want: models.ResourceQuota{ - Name: mockRQResponse.Name, - Elements: []*models.ResourceQuotaElement{ - { - Name: "storage", - Hard: int64(1000), - Used: int64(500), - }, - { - Name: "cpu", - Hard: int64(2048), - Used: int64(1024), - }, - }, - }, - mockResourceQuota: func(ctx context.Context, namespace, resource string, opts metav1.GetOptions) (*v1.ResourceQuota, error) { - return &mockRQResponse, nil - }, - wantErr: false, - }, - { - name: "Return empty resource quota elements", - args: args{ - ctx: ctx, - client: kClient, - }, - want: models.ResourceQuota{}, - mockResourceQuota: func(ctx context.Context, namespace, resource string, opts metav1.GetOptions) (*v1.ResourceQuota, error) { - return &v1.ResourceQuota{}, nil - }, - wantErr: false, - }, - { - name: "Handle error while fetching storage quota elements", - args: args{ - ctx: ctx, - client: kClient, - }, - wantErr: true, - mockResourceQuota: func(ctx context.Context, namespace, resource string, opts metav1.GetOptions) (*v1.ResourceQuota, error) { - return nil, errors.New("error") - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - k8sClientGetResourceQuotaMock = tt.mockResourceQuota - got, err := getResourceQuota(tt.args.ctx, tt.args.client, "ns", mockRQResponse.Name) - if err != nil { - if tt.wantErr { - return - } - t.Errorf("getResourceQuota() error = %v, wantErr %v", err, tt.wantErr) - } - if reflect.DeepEqual(got, tt.want) { - t.Errorf("got %v want %v", got, tt.want) - } - }) - } -} diff --git a/operatorapi/server.go b/operatorapi/server.go deleted file mode 100644 index 8c001fda6..000000000 --- a/operatorapi/server.go +++ /dev/null @@ -1,524 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package operatorapi - -import ( - "context" - "crypto/tls" - "crypto/x509" - "errors" - "fmt" - "log" - "net" - "net/http" - "os" - "os/signal" - "strconv" - "sync" - "sync/atomic" - "syscall" - "time" - - "github.com/go-openapi/runtime/flagext" - "github.com/go-openapi/swag" - flags "github.com/jessevdk/go-flags" - "golang.org/x/net/netutil" - - "github.com/minio/console/operatorapi/operations" -) - -const ( - schemeHTTP = "http" - schemeHTTPS = "https" - schemeUnix = "unix" -) - -var defaultSchemes []string - -func init() { - defaultSchemes = []string{ - schemeHTTP, - } -} - -// NewServer creates a new api operator server but does not configure it -func NewServer(api *operations.OperatorAPI) *Server { - s := new(Server) - - s.shutdown = make(chan struct{}) - s.api = api - s.interrupt = make(chan os.Signal, 1) - return s -} - -// ConfigureAPI configures the API and handlers. -func (s *Server) ConfigureAPI() { - if s.api != nil { - s.handler = configureAPI(s.api) - } -} - -// ConfigureFlags configures the additional flags defined by the handlers. Needs to be called before the parser.Parse -func (s *Server) ConfigureFlags() { - if s.api != nil { - configureFlags(s.api) - } -} - -// Server for the operator API -type Server struct { - EnabledListeners []string `long:"scheme" description:"the listeners to enable, this can be repeated and defaults to the schemes in the swagger spec"` - CleanupTimeout time.Duration `long:"cleanup-timeout" description:"grace period for which to wait before killing idle connections" default:"10s"` - GracefulTimeout time.Duration `long:"graceful-timeout" description:"grace period for which to wait before shutting down the server" default:"15s"` - MaxHeaderSize flagext.ByteSize `long:"max-header-size" description:"controls the maximum number of bytes the server will read parsing the request header's keys and values, including the request line. It does not limit the size of the request body." default:"1MiB"` - - SocketPath flags.Filename `long:"socket-path" description:"the unix socket to listen on" default:"/var/run/operator.sock"` - domainSocketL net.Listener - - Host string `long:"host" description:"the IP to listen on" default:"localhost" env:"HOST"` - Port int `long:"port" description:"the port to listen on for insecure connections, defaults to a random value" env:"PORT"` - ListenLimit int `long:"listen-limit" description:"limit the number of outstanding requests"` - KeepAlive time.Duration `long:"keep-alive" description:"sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download)" default:"3m"` - ReadTimeout time.Duration `long:"read-timeout" description:"maximum duration before timing out read of the request" default:"30s"` - WriteTimeout time.Duration `long:"write-timeout" description:"maximum duration before timing out write of the response" default:"60s"` - httpServerL net.Listener - - TLSHost string `long:"tls-host" description:"the IP to listen on for tls, when not specified it's the same as --host" env:"TLS_HOST"` - TLSPort int `long:"tls-port" description:"the port to listen on for secure connections, defaults to a random value" env:"TLS_PORT"` - TLSCertificate flags.Filename `long:"tls-certificate" description:"the certificate to use for secure connections" env:"TLS_CERTIFICATE"` - TLSCertificateKey flags.Filename `long:"tls-key" description:"the private key to use for secure connections" env:"TLS_PRIVATE_KEY"` - TLSCACertificate flags.Filename `long:"tls-ca" description:"the certificate authority file to be used with mutual tls auth" env:"TLS_CA_CERTIFICATE"` - TLSListenLimit int `long:"tls-listen-limit" description:"limit the number of outstanding requests"` - TLSKeepAlive time.Duration `long:"tls-keep-alive" description:"sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download)"` - TLSReadTimeout time.Duration `long:"tls-read-timeout" description:"maximum duration before timing out read of the request"` - TLSWriteTimeout time.Duration `long:"tls-write-timeout" description:"maximum duration before timing out write of the response"` - httpsServerL net.Listener - - api *operations.OperatorAPI - handler http.Handler - hasListeners bool - shutdown chan struct{} - shuttingDown int32 - interrupted bool - interrupt chan os.Signal -} - -// Logf logs message either via defined user logger or via system one if no user logger is defined. -func (s *Server) Logf(f string, args ...interface{}) { - if s.api != nil && s.api.Logger != nil { - s.api.Logger(f, args...) - } else { - log.Printf(f, args...) - } -} - -// Fatalf logs message either via defined user logger or via system one if no user logger is defined. -// Exits with non-zero status after printing -func (s *Server) Fatalf(f string, args ...interface{}) { - if s.api != nil && s.api.Logger != nil { - s.api.Logger(f, args...) - os.Exit(1) - } else { - log.Fatalf(f, args...) - } -} - -// SetAPI configures the server with the specified API. Needs to be called before Serve -func (s *Server) SetAPI(api *operations.OperatorAPI) { - if api == nil { - s.api = nil - s.handler = nil - return - } - - s.api = api - s.handler = configureAPI(api) -} - -func (s *Server) hasScheme(scheme string) bool { - schemes := s.EnabledListeners - if len(schemes) == 0 { - schemes = defaultSchemes - } - - for _, v := range schemes { - if v == scheme { - return true - } - } - return false -} - -// Serve the api -func (s *Server) Serve() (err error) { - if !s.hasListeners { - if err = s.Listen(); err != nil { - return err - } - } - - // set default handler, if none is set - if s.handler == nil { - if s.api == nil { - return errors.New("can't create the default handler, as no api is set") - } - - s.SetHandler(s.api.Serve(nil)) - } - - wg := new(sync.WaitGroup) - once := new(sync.Once) - signalNotify(s.interrupt) - go handleInterrupt(once, s) - - servers := []*http.Server{} - - if s.hasScheme(schemeUnix) { - domainSocket := new(http.Server) - domainSocket.MaxHeaderBytes = int(s.MaxHeaderSize) - domainSocket.Handler = s.handler - if int64(s.CleanupTimeout) > 0 { - domainSocket.IdleTimeout = s.CleanupTimeout - } - - configureServer(domainSocket, "unix", string(s.SocketPath)) - - servers = append(servers, domainSocket) - wg.Add(1) - s.Logf("Serving operator at unix://%s", s.SocketPath) - go func(l net.Listener) { - defer wg.Done() - if err := domainSocket.Serve(l); err != nil && err != http.ErrServerClosed { - s.Fatalf("%v", err) - } - s.Logf("Stopped serving operator at unix://%s", s.SocketPath) - }(s.domainSocketL) - } - - if s.hasScheme(schemeHTTP) { - httpServer := new(http.Server) - httpServer.MaxHeaderBytes = int(s.MaxHeaderSize) - httpServer.ReadTimeout = s.ReadTimeout - httpServer.WriteTimeout = s.WriteTimeout - httpServer.SetKeepAlivesEnabled(int64(s.KeepAlive) > 0) - if s.ListenLimit > 0 { - s.httpServerL = netutil.LimitListener(s.httpServerL, s.ListenLimit) - } - - if int64(s.CleanupTimeout) > 0 { - httpServer.IdleTimeout = s.CleanupTimeout - } - - httpServer.Handler = s.handler - - configureServer(httpServer, "http", s.httpServerL.Addr().String()) - - servers = append(servers, httpServer) - wg.Add(1) - s.Logf("Serving operator at http://%s", s.httpServerL.Addr()) - go func(l net.Listener) { - defer wg.Done() - if err := httpServer.Serve(l); err != nil && err != http.ErrServerClosed { - s.Fatalf("%v", err) - } - s.Logf("Stopped serving operator at http://%s", l.Addr()) - }(s.httpServerL) - } - - if s.hasScheme(schemeHTTPS) { - httpsServer := new(http.Server) - httpsServer.MaxHeaderBytes = int(s.MaxHeaderSize) - httpsServer.ReadTimeout = s.TLSReadTimeout - httpsServer.WriteTimeout = s.TLSWriteTimeout - httpsServer.SetKeepAlivesEnabled(int64(s.TLSKeepAlive) > 0) - if s.TLSListenLimit > 0 { - s.httpsServerL = netutil.LimitListener(s.httpsServerL, s.TLSListenLimit) - } - if int64(s.CleanupTimeout) > 0 { - httpsServer.IdleTimeout = s.CleanupTimeout - } - httpsServer.Handler = s.handler - - // Inspired by https://blog.bracebin.com/achieving-perfect-ssl-labs-score-with-go - httpsServer.TLSConfig = &tls.Config{ - // Causes servers to use Go's default ciphersuite preferences, - // which are tuned to avoid attacks. Does nothing on clients. - PreferServerCipherSuites: true, - // Only use curves which have assembly implementations - // https://github.com/golang/go/tree/master/src/crypto/elliptic - CurvePreferences: []tls.CurveID{tls.CurveP256}, - // Use modern tls mode https://wiki.mozilla.org/Security/Server_Side_TLS#Modern_compatibility - NextProtos: []string{"h2", "http/1.1"}, - // https://www.owasp.org/index.php/Transport_Layer_Protection_Cheat_Sheet#Rule_-_Only_Support_Strong_Protocols - MinVersion: tls.VersionTLS12, - // These ciphersuites support Forward Secrecy: https://en.wikipedia.org/wiki/Forward_secrecy - CipherSuites: []uint16{ - tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, - tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, - tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, - tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, - tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, - tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, - }, - } - - // build standard config from server options - if s.TLSCertificate != "" && s.TLSCertificateKey != "" { - httpsServer.TLSConfig.Certificates = make([]tls.Certificate, 1) - httpsServer.TLSConfig.Certificates[0], err = tls.LoadX509KeyPair(string(s.TLSCertificate), string(s.TLSCertificateKey)) - if err != nil { - return err - } - } - - if s.TLSCACertificate != "" { - // include specified CA certificate - caCert, caCertErr := os.ReadFile(string(s.TLSCACertificate)) - if caCertErr != nil { - return caCertErr - } - caCertPool := x509.NewCertPool() - ok := caCertPool.AppendCertsFromPEM(caCert) - if !ok { - return fmt.Errorf("cannot parse CA certificate") - } - httpsServer.TLSConfig.ClientCAs = caCertPool - httpsServer.TLSConfig.ClientAuth = tls.RequireAndVerifyClientCert - } - - // call custom TLS configurator - configureTLS(httpsServer.TLSConfig) - - if len(httpsServer.TLSConfig.Certificates) == 0 && httpsServer.TLSConfig.GetCertificate == nil { - // after standard and custom config are passed, this ends up with no certificate - if s.TLSCertificate == "" { - if s.TLSCertificateKey == "" { - s.Fatalf("the required flags `--tls-certificate` and `--tls-key` were not specified") - } - s.Fatalf("the required flag `--tls-certificate` was not specified") - } - if s.TLSCertificateKey == "" { - s.Fatalf("the required flag `--tls-key` was not specified") - } - // this happens with a wrong custom TLS configurator - s.Fatalf("no certificate was configured for TLS") - } - - configureServer(httpsServer, "https", s.httpsServerL.Addr().String()) - - servers = append(servers, httpsServer) - wg.Add(1) - s.Logf("Serving operator at https://%s", s.httpsServerL.Addr()) - go func(l net.Listener) { - defer wg.Done() - if err := httpsServer.Serve(l); err != nil && err != http.ErrServerClosed { - s.Fatalf("%v", err) - } - s.Logf("Stopped serving operator at https://%s", l.Addr()) - }(tls.NewListener(s.httpsServerL, httpsServer.TLSConfig)) - } - - wg.Add(1) - go s.handleShutdown(wg, &servers) - - wg.Wait() - return nil -} - -// Listen creates the listeners for the server -func (s *Server) Listen() error { - if s.hasListeners { // already done this - return nil - } - - if s.hasScheme(schemeHTTPS) { - // Use http host if https host wasn't defined - if s.TLSHost == "" { - s.TLSHost = s.Host - } - // Use http listen limit if https listen limit wasn't defined - if s.TLSListenLimit == 0 { - s.TLSListenLimit = s.ListenLimit - } - // Use http tcp keep alive if https tcp keep alive wasn't defined - if int64(s.TLSKeepAlive) == 0 { - s.TLSKeepAlive = s.KeepAlive - } - // Use http read timeout if https read timeout wasn't defined - if int64(s.TLSReadTimeout) == 0 { - s.TLSReadTimeout = s.ReadTimeout - } - // Use http write timeout if https write timeout wasn't defined - if int64(s.TLSWriteTimeout) == 0 { - s.TLSWriteTimeout = s.WriteTimeout - } - } - - if s.hasScheme(schemeUnix) { - domSockListener, err := net.Listen("unix", string(s.SocketPath)) - if err != nil { - return err - } - s.domainSocketL = domSockListener - } - - if s.hasScheme(schemeHTTP) { - listener, err := net.Listen("tcp", net.JoinHostPort(s.Host, strconv.Itoa(s.Port))) - if err != nil { - return err - } - - h, p, err := swag.SplitHostPort(listener.Addr().String()) - if err != nil { - return err - } - s.Host = h - s.Port = p - s.httpServerL = listener - } - - if s.hasScheme(schemeHTTPS) { - tlsListener, err := net.Listen("tcp", net.JoinHostPort(s.TLSHost, strconv.Itoa(s.TLSPort))) - if err != nil { - return err - } - - sh, sp, err := swag.SplitHostPort(tlsListener.Addr().String()) - if err != nil { - return err - } - s.TLSHost = sh - s.TLSPort = sp - s.httpsServerL = tlsListener - } - - s.hasListeners = true - return nil -} - -// Shutdown server and clean up resources -func (s *Server) Shutdown() error { - if atomic.CompareAndSwapInt32(&s.shuttingDown, 0, 1) { - close(s.shutdown) - } - return nil -} - -func (s *Server) handleShutdown(wg *sync.WaitGroup, serversPtr *[]*http.Server) { - // wg.Done must occur last, after s.api.ServerShutdown() - // (to preserve old behaviour) - defer wg.Done() - - <-s.shutdown - - servers := *serversPtr - - ctx, cancel := context.WithTimeout(context.TODO(), s.GracefulTimeout) - defer cancel() - - // first execute the pre-shutdown hook - s.api.PreServerShutdown() - - shutdownChan := make(chan bool) - for i := range servers { - server := servers[i] - go func() { - var success bool - defer func() { - shutdownChan <- success - }() - if err := server.Shutdown(ctx); err != nil { - // Error from closing listeners, or context timeout: - s.Logf("HTTP server Shutdown: %v", err) - } else { - success = true - } - }() - } - - // Wait until all listeners have successfully shut down before calling ServerShutdown - success := true - for range servers { - success = success && <-shutdownChan - } - if success { - s.api.ServerShutdown() - } -} - -// GetHandler returns a handler useful for testing -func (s *Server) GetHandler() http.Handler { - return s.handler -} - -// SetHandler allows for setting a http handler on this server -func (s *Server) SetHandler(handler http.Handler) { - s.handler = handler -} - -// UnixListener returns the domain socket listener -func (s *Server) UnixListener() (net.Listener, error) { - if !s.hasListeners { - if err := s.Listen(); err != nil { - return nil, err - } - } - return s.domainSocketL, nil -} - -// HTTPListener returns the http listener -func (s *Server) HTTPListener() (net.Listener, error) { - if !s.hasListeners { - if err := s.Listen(); err != nil { - return nil, err - } - } - return s.httpServerL, nil -} - -// TLSListener returns the https listener -func (s *Server) TLSListener() (net.Listener, error) { - if !s.hasListeners { - if err := s.Listen(); err != nil { - return nil, err - } - } - return s.httpsServerL, nil -} - -func handleInterrupt(once *sync.Once, s *Server) { - once.Do(func() { - for range s.interrupt { - if s.interrupted { - s.Logf("Server already shutting down") - continue - } - s.interrupted = true - s.Logf("Shutting down... ") - if err := s.Shutdown(); err != nil { - s.Logf("HTTP server Shutdown: %v", err) - } - } - }) -} - -func signalNotify(interrupt chan<- os.Signal) { - signal.Notify(interrupt, syscall.SIGINT, syscall.SIGTERM) -} diff --git a/operatorapi/session.go b/operatorapi/session.go deleted file mode 100644 index 1dade0cbe..000000000 --- a/operatorapi/session.go +++ /dev/null @@ -1,70 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "fmt" - - errors "github.com/minio/console/restapi" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations" - authApi "github.com/minio/console/operatorapi/operations/auth" -) - -func registerSessionHandlers(api *operations.OperatorAPI) { - // session check - api.AuthSessionCheckHandler = authApi.SessionCheckHandlerFunc(func(params authApi.SessionCheckParams, session *models.Principal) middleware.Responder { - sessionResp, err := getSessionResponse(session, params) - if err != nil { - return authApi.NewSessionCheckDefault(int(err.Code)).WithPayload(err) - } - return authApi.NewSessionCheckOK().WithPayload(sessionResp) - }) -} - -// getSessionResponse parse the token of the current session and returns a list of allowed actions to render in the UI -func getSessionResponse(session *models.Principal, params authApi.SessionCheckParams) (*models.OperatorSessionResponse, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - // serialize output - if session == nil { - return nil, errors.ErrorWithContext(ctx, errors.ErrInvalidSession) - } - sessionResp := &models.OperatorSessionResponse{ - Status: models.OperatorSessionResponseStatusOk, - Operator: true, - Permissions: map[string][]string{}, - Features: getListOfOperatorFeatures(), - DirectPV: getDirectPVEnabled(), - } - return sessionResp, nil -} - -// getListOfEnabledFeatures returns a list of features -func getListOfOperatorFeatures() []string { - features := []string{} - mpEnabled := getMarketplace() - - if mpEnabled != "" { - features = append(features, fmt.Sprintf("mp-mode-%s", mpEnabled)) - } - - return features -} diff --git a/operatorapi/tenant_add.go b/operatorapi/tenant_add.go deleted file mode 100644 index a54afdc12..000000000 --- a/operatorapi/tenant_add.go +++ /dev/null @@ -1,659 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2022 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "encoding/base64" - "fmt" - - "github.com/dustin/go-humanize" - "github.com/minio/console/restapi" - - "github.com/minio/console/operatorapi/operations/operator_api" - - corev1 "k8s.io/api/core/v1" - - "github.com/go-openapi/swag" - "github.com/minio/console/cluster" - "github.com/minio/console/models" - miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func getTenantCreatedResponse(session *models.Principal, params operator_api.CreateTenantParams) (response *models.CreateTenantResponse, mError *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - // get Kubernetes Client - clientSet, err := cluster.K8sClient(session.STSSessionToken) - k8sClient := &k8sClient{ - client: clientSet, - } - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - - return createTenant(ctx, params, k8sClient, session) -} - -func createTenant(ctx context.Context, params operator_api.CreateTenantParams, clientSet K8sClientI, session *models.Principal) (response *models.CreateTenantResponse, mError *models.Error) { - tenantReq := params.Body - minioImage := getTenantMinIOImage(tenantReq.Image) - - ns := *tenantReq.Namespace - - accessKey, secretKey := getTenantCredentials(tenantReq.AccessKey, tenantReq.SecretKey) - tenantName := *tenantReq.Name - var users []*corev1.LocalObjectReference - - // delete secrets created if an errors occurred during tenant creation, - defer func() { - deleteSecretsIfTenantCreationFails(ctx, mError, tenantName, ns, clientSet) - }() - - err := createTenantCredentialsSecret(ctx, ns, tenantName, clientSet) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - - tenantConfigurationENV := map[string]string{} - tenantConfigurationENV["MINIO_BROWSER"] = isTenantConsoleEnabled(tenantReq.EnableConsole) - tenantConfigurationENV["MINIO_ROOT_USER"] = accessKey - tenantConfigurationENV["MINIO_ROOT_PASSWORD"] = secretKey - - // Check the Erasure Coding Parity for validity and pass it to Tenant - if tenantReq.ErasureCodingParity > 0 { - if tenantReq.ErasureCodingParity < 2 || tenantReq.ErasureCodingParity > 8 { - return nil, restapi.ErrorWithContext(ctx, restapi.ErrInvalidErasureCodingValue) - } - tenantConfigurationENV["MINIO_STORAGE_CLASS_STANDARD"] = fmt.Sprintf("EC:%d", tenantReq.ErasureCodingParity) - } - - // Construct a MinIO Instance with everything we are getting from parameters - minInst := miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Name: tenantName, - Labels: tenantReq.Labels, - }, - Spec: miniov2.TenantSpec{ - Image: minioImage, - Mountpath: "/export", - CredsSecret: &corev1.LocalObjectReference{ - Name: fmt.Sprintf("%s-secret", tenantName), - }, - }, - } - var tenantExternalIDPConfigured bool - if tenantReq.Idp != nil { - // Enable IDP (Active Directory) for MinIO - switch { - case tenantReq.Idp.ActiveDirectory != nil: - tenantExternalIDPConfigured = true - tenantConfigurationENV, users, err = setTenantActiveDirectoryConfig(ctx, clientSet, tenantReq, tenantConfigurationENV, users) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - // attach the users to the tenant - minInst.Spec.Users = users - case tenantReq.Idp.Oidc != nil: - tenantExternalIDPConfigured = true - tenantConfigurationENV = setTenantOIDCConfig(tenantReq, tenantConfigurationENV) - case len(tenantReq.Idp.Keys) > 0: - users, err = setTenantBuiltInUsers(ctx, clientSet, tenantReq, users) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - // attach the users to the tenant - minInst.Spec.Users = users - } - } - - canEncryptionBeEnabled := false - - if tenantReq.EnableTLS != nil { - // if enableTLS is defined in the create tenant request we assign the value - // to the RequestAutoCert attribute in the tenant spec - minInst.Spec.RequestAutoCert = tenantReq.EnableTLS - if *tenantReq.EnableTLS { - // requestAutoCert is enabled, MinIO will be deployed with TLS enabled and encryption can be enabled - canEncryptionBeEnabled = true - } - } - // External server TLS certificates for MinIO - if tenantReq.TLS != nil && len(tenantReq.TLS.MinioServerCertificates) > 0 { - canEncryptionBeEnabled = true - // Certificates used by the MinIO instance - externalCertSecretName := fmt.Sprintf("%s-external-server-certificate", tenantName) - externalCertSecret, err := createOrReplaceExternalCertSecrets(ctx, clientSet, ns, tenantReq.TLS.MinioServerCertificates, externalCertSecretName, tenantName) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - minInst.Spec.ExternalCertSecret = externalCertSecret - } - // External client TLS certificates for MinIO - if tenantReq.TLS != nil && len(tenantReq.TLS.MinioClientCertificates) > 0 { - // Client certificates used by the MinIO instance - externalClientCertSecretName := fmt.Sprintf("%s-external-client-certificate", tenantName) - externalClientCertSecret, err := createOrReplaceExternalCertSecrets(ctx, clientSet, ns, tenantReq.TLS.MinioClientCertificates, externalClientCertSecretName, tenantName) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - minInst.Spec.ExternalClientCertSecrets = externalClientCertSecret - } - // If encryption configuration is present and TLS will be enabled (using AutoCert or External certificates) - if tenantReq.Encryption != nil && canEncryptionBeEnabled { - // KES client mTLSCertificates used by MinIO instance - if tenantReq.Encryption.MinioMtls != nil { - tenantExternalClientCertSecretName := fmt.Sprintf("%s-external-client-certificate-kes", tenantName) - certificates := []*models.KeyPairConfiguration{tenantReq.Encryption.MinioMtls} - certificateSecrets, err := createOrReplaceExternalCertSecrets(ctx, clientSet, ns, certificates, tenantExternalClientCertSecretName, tenantName) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, restapi.ErrDefault) - } - if len(certificateSecrets) > 0 { - minInst.Spec.ExternalClientCertSecret = certificateSecrets[0] - } - } - - // KES configuration for Tenant instance - minInst.Spec.KES, err = getKESConfiguration(ctx, clientSet, ns, tenantReq.Encryption, fmt.Sprintf("%s-secret", tenantName), tenantName) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, restapi.ErrDefault) - } - // Set Labels, Annotations and Node Selector for KES - minInst.Spec.KES.Labels = tenantReq.Encryption.Labels - minInst.Spec.KES.Annotations = tenantReq.Encryption.Annotations - minInst.Spec.KES.NodeSelector = tenantReq.Encryption.NodeSelector - - if tenantReq.Encryption.SecurityContext != nil { - sc, err := convertModelSCToK8sSC(tenantReq.Encryption.SecurityContext) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - minInst.Spec.KES.SecurityContext = sc - } - } - // External TLS CA certificates for MinIO - if tenantReq.TLS != nil && len(tenantReq.TLS.MinioCAsCertificates) > 0 { - var caCertificates []tenantSecret - for i, caCertificate := range tenantReq.TLS.MinioCAsCertificates { - certificateContent, err := base64.StdEncoding.DecodeString(caCertificate) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, restapi.ErrDefault, nil, err) - } - caCertificates = append(caCertificates, tenantSecret{ - Name: fmt.Sprintf("%s-ca-certificate-%d", tenantName, i), - Content: map[string][]byte{ - "public.crt": certificateContent, - }, - }) - } - if len(caCertificates) > 0 { - certificateSecrets, err := createOrReplaceSecrets(ctx, clientSet, ns, caCertificates, tenantName) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, restapi.ErrDefault, nil, err) - } - minInst.Spec.ExternalCaCertSecret = certificateSecrets - } - } - - // add annotations - var annotations map[string]string - - if len(tenantReq.Annotations) > 0 { - annotations = tenantReq.Annotations - minInst.Annotations = annotations - } - // set the pools if they are provided - for _, pool := range tenantReq.Pools { - pool, err := parseTenantPoolRequest(pool) - if err != nil { - restapi.LogError("parseTenantPoolRequest failed: %v", err) - return nil, restapi.ErrorWithContext(ctx, err) - } - minInst.Spec.Pools = append(minInst.Spec.Pools, *pool) - } - - // Set Mount Path if provided - if tenantReq.MountPath != "" { - minInst.Spec.Mountpath = tenantReq.MountPath - } - - // We accept either `image_pull_secret` or the individual details of the `image_registry` but not both - var imagePullSecret string - - if tenantReq.ImagePullSecret != "" { - imagePullSecret = tenantReq.ImagePullSecret - } else if imagePullSecret, err = setImageRegistry(ctx, tenantReq.ImageRegistry, clientSet, ns, tenantName); err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - // pass the image pull secret to the Tenant - if imagePullSecret != "" { - minInst.Spec.ImagePullSecret = corev1.LocalObjectReference{ - Name: imagePullSecret, - } - } - - // prometheus annotations support - if tenantReq.EnablePrometheus != nil && *tenantReq.EnablePrometheus && minInst.Annotations != nil { - minInst.Annotations[prometheusPath] = "/minio/prometheus/metrics" - minInst.Annotations[prometheusPort] = fmt.Sprint(miniov2.MinIOPort) - minInst.Annotations[prometheusScrape] = "true" - } - - // Is Log Search enabled? (present in the parameters) if so configure - if tenantReq.LogSearchConfiguration != nil { - minInst, err = setTenantLogSearchConfiguration(ctx, tenantReq, minInst) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - } - - // Is Prometheus/Monitoring enabled? (config present in the parameters) if so configure - if tenantReq.PrometheusConfiguration != nil { - minInst, err = setTenantPrometheusConfig(ctx, tenantReq, minInst) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - } - - // expose services - minInst.Spec.ExposeServices = &miniov2.ExposeServices{ - MinIO: tenantReq.ExposeMinio, - Console: tenantReq.ExposeConsole, - } - - // set custom environment variables in configuration file - for _, envVar := range tenantReq.EnvironmentVariables { - tenantConfigurationENV[envVar.Key] = envVar.Value - } - - // write tenant configuration to secret that contains config.env - tenantConfigurationName := fmt.Sprintf("%s-env-configuration", tenantName) - _, err = createOrReplaceSecrets(ctx, clientSet, ns, []tenantSecret{ - { - Name: tenantConfigurationName, - Content: map[string][]byte{ - "config.env": []byte(GenerateTenantConfigurationFile(tenantConfigurationENV)), - }, - }, - }, tenantName) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, restapi.ErrDefault, nil, err) - } - minInst.Spec.Configuration = &corev1.LocalObjectReference{Name: tenantConfigurationName} - - if tenantReq.Domains != nil { - var features miniov2.Features - var domains miniov2.TenantDomains - - // tenant domains - if tenantReq.Domains.Console != "" { - domains.Console = tenantReq.Domains.Console - } - - if tenantReq.Domains.Minio != nil { - domains.Minio = tenantReq.Domains.Minio - } - - features.Domains = &domains - - minInst.Spec.Features = &features - } - - opClient, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - - _, err = opClient.MinioV2().Tenants(ns).Create(context.Background(), &minInst, metav1.CreateOptions{}) - if err != nil { - restapi.LogError("Creating new tenant failed with: %v", err) - return nil, restapi.ErrorWithContext(ctx, err) - } - - response = &models.CreateTenantResponse{ - ExternalIDP: tenantExternalIDPConfigured, - } - thisClient := &operatorClient{ - client: opClient, - } - - minTenant, _ := getTenant(ctx, thisClient, ns, tenantName) - - if tenantReq.Idp != nil && !tenantExternalIDPConfigured { - for _, credential := range tenantReq.Idp.Keys { - response.Console = append(response.Console, &models.TenantResponseItem{ - AccessKey: *credential.AccessKey, - SecretKey: *credential.SecretKey, - URL: GetTenantServiceURL(minTenant), - }) - } - } - return response, nil -} - -func getTenantMinIOImage(minioImage string) string { - if minioImage == "" { - minImg, err := cluster.GetMinioImage() - // we can live without figuring out the latest version of MinIO, Operator will use a hardcoded value - if err == nil { - minioImage = *minImg - } - } - return minioImage -} - -func getTenantCredentials(accessKey, secretKey string) (string, string) { - defaultAccessKey := restapi.RandomCharString(16) - defaultSecretKey := restapi.RandomCharString(32) - if accessKey != "" { - defaultAccessKey = accessKey - } - if secretKey != "" { - defaultSecretKey = secretKey - } - return defaultAccessKey, defaultSecretKey -} - -func createTenantCredentialsSecret(ctx context.Context, ns, tenantName string, clientSet K8sClientI) error { - imm := true - // Create the secret for the root credentials (deprecated) - secretName := fmt.Sprintf("%s-secret", tenantName) - instanceSecret := corev1.Secret{ - ObjectMeta: metav1.ObjectMeta{ - Name: secretName, - Labels: map[string]string{ - miniov2.TenantLabel: tenantName, - }, - }, - Immutable: &imm, - Data: map[string][]byte{ - "accesskey": []byte(""), - "secretkey": []byte(""), - }, - } - _, err := clientSet.createSecret(ctx, ns, &instanceSecret, metav1.CreateOptions{}) - return err -} - -func isTenantConsoleEnabled(enable *bool) string { - enabledConsole := "on" - if enable != nil && !*enable { - enabledConsole = "off" - } - return enabledConsole -} - -func deleteSecretsIfTenantCreationFails(ctx context.Context, mError *models.Error, tenantName, ns string, clientSet K8sClientI) { - if mError != nil { - restapi.LogError("deleting secrets created for failed tenant: %s if any: %v", tenantName, mError) - opts := metav1.ListOptions{ - LabelSelector: fmt.Sprintf("%s=%s", miniov2.TenantLabel, tenantName), - } - err := clientSet.deleteSecretsCollection(ctx, ns, metav1.DeleteOptions{}, opts) - if err != nil { - restapi.LogError("error deleting tenant's secrets: %v", err) - } - } -} - -func setTenantActiveDirectoryConfig(ctx context.Context, clientSet K8sClientI, tenantReq *models.CreateTenantRequest, tenantConfigurationENV map[string]string, users []*corev1.LocalObjectReference) (map[string]string, []*corev1.LocalObjectReference, error) { - imm := true - serverAddress := *tenantReq.Idp.ActiveDirectory.URL - tlsSkipVerify := tenantReq.Idp.ActiveDirectory.SkipTLSVerification - serverInsecure := tenantReq.Idp.ActiveDirectory.ServerInsecure - lookupBindDN := *tenantReq.Idp.ActiveDirectory.LookupBindDn - lookupBindPassword := tenantReq.Idp.ActiveDirectory.LookupBindPassword - userDNSearchBaseDN := tenantReq.Idp.ActiveDirectory.UserDnSearchBaseDn - userDNSearchFilter := tenantReq.Idp.ActiveDirectory.UserDnSearchFilter - groupSearchBaseDN := tenantReq.Idp.ActiveDirectory.GroupSearchBaseDn - groupSearchFilter := tenantReq.Idp.ActiveDirectory.GroupSearchFilter - serverStartTLS := tenantReq.Idp.ActiveDirectory.ServerStartTLS - - // LDAP Server - tenantConfigurationENV["MINIO_IDENTITY_LDAP_SERVER_ADDR"] = serverAddress - if tlsSkipVerify { - tenantConfigurationENV["MINIO_IDENTITY_LDAP_TLS_SKIP_VERIFY"] = "on" - } - if serverInsecure { - tenantConfigurationENV["MINIO_IDENTITY_LDAP_SERVER_INSECURE"] = "on" - } - if serverStartTLS { - tenantConfigurationENV["MINIO_IDENTITY_LDAP_SERVER_STARTTLS"] = "on" - } - - // LDAP Lookup - tenantConfigurationENV["MINIO_IDENTITY_LDAP_LOOKUP_BIND_DN"] = lookupBindDN - tenantConfigurationENV["MINIO_IDENTITY_LDAP_LOOKUP_BIND_PASSWORD"] = lookupBindPassword - - // LDAP User DN - tenantConfigurationENV["MINIO_IDENTITY_LDAP_USER_DN_SEARCH_BASE_DN"] = userDNSearchBaseDN - tenantConfigurationENV["MINIO_IDENTITY_LDAP_USER_DN_SEARCH_FILTER"] = userDNSearchFilter - - // LDAP Group - tenantConfigurationENV["MINIO_IDENTITY_LDAP_GROUP_SEARCH_BASE_DN"] = groupSearchBaseDN - tenantConfigurationENV["MINIO_IDENTITY_LDAP_GROUP_SEARCH_FILTER"] = groupSearchFilter - - // Attach the list of LDAP user DNs that will be administrator for the Tenant - for i, userDN := range tenantReq.Idp.ActiveDirectory.UserDNS { - userSecretName := fmt.Sprintf("%s-user-%d", *tenantReq.Name, i) - users = append(users, &corev1.LocalObjectReference{Name: userSecretName}) - - userSecret := corev1.Secret{ - ObjectMeta: metav1.ObjectMeta{ - Name: userSecretName, - Labels: map[string]string{ - miniov2.TenantLabel: *tenantReq.Name, - }, - }, - Immutable: &imm, - Data: map[string][]byte{ - "CONSOLE_ACCESS_KEY": []byte(userDN), - }, - } - _, err := clientSet.createSecret(ctx, *tenantReq.Namespace, &userSecret, metav1.CreateOptions{}) - if err != nil { - return tenantConfigurationENV, users, err - } - } - return tenantConfigurationENV, users, nil -} - -func setTenantOIDCConfig(tenantReq *models.CreateTenantRequest, tenantConfigurationENV map[string]string) map[string]string { - configurationURL := *tenantReq.Idp.Oidc.ConfigurationURL - clientID := *tenantReq.Idp.Oidc.ClientID - secretID := *tenantReq.Idp.Oidc.SecretID - claimName := *tenantReq.Idp.Oidc.ClaimName - scopes := tenantReq.Idp.Oidc.Scopes - callbackURL := tenantReq.Idp.Oidc.CallbackURL - tenantConfigurationENV["MINIO_IDENTITY_OPENID_CONFIG_URL"] = configurationURL - tenantConfigurationENV["MINIO_IDENTITY_OPENID_CLIENT_ID"] = clientID - tenantConfigurationENV["MINIO_IDENTITY_OPENID_CLIENT_SECRET"] = secretID - tenantConfigurationENV["MINIO_IDENTITY_OPENID_CLAIM_NAME"] = claimName - tenantConfigurationENV["MINIO_IDENTITY_OPENID_REDIRECT_URI"] = callbackURL - if scopes == "" { - scopes = "openid,profile,email" - } - tenantConfigurationENV["MINIO_IDENTITY_OPENID_SCOPES"] = scopes - return tenantConfigurationENV -} - -func setTenantBuiltInUsers(ctx context.Context, clientSet K8sClientI, tenantReq *models.CreateTenantRequest, users []*corev1.LocalObjectReference) ([]*corev1.LocalObjectReference, error) { - imm := true - for i := 0; i < len(tenantReq.Idp.Keys); i++ { - userSecretName := fmt.Sprintf("%s-user-%d", *tenantReq.Name, i) - users = append(users, &corev1.LocalObjectReference{Name: userSecretName}) - userSecret := corev1.Secret{ - ObjectMeta: metav1.ObjectMeta{ - Name: userSecretName, - Labels: map[string]string{ - miniov2.TenantLabel: *tenantReq.Name, - }, - }, - Immutable: &imm, - Data: map[string][]byte{ - "CONSOLE_ACCESS_KEY": []byte(*tenantReq.Idp.Keys[i].AccessKey), - "CONSOLE_SECRET_KEY": []byte(*tenantReq.Idp.Keys[i].SecretKey), - }, - } - _, err := clientSet.createSecret(ctx, *tenantReq.Namespace, &userSecret, metav1.CreateOptions{}) - if err != nil { - return users, err - } - } - return users, nil -} - -func setTenantLogSearchConfiguration(ctx context.Context, tenantReq *models.CreateTenantRequest, minInst miniov2.Tenant) (miniov2.Tenant, error) { - diskSpaceFromAPI := int64(5) * humanize.GiByte // Default is 5Gi - logSearchImage := "" - logSearchPgImage := "" - logSearchPgInitImage := "" - var logSearchStorageClass *string // Nil means use default storage class - var logSearchSecurityContext *corev1.PodSecurityContext - var logSearchPgSecurityContext *corev1.PodSecurityContext - - if tenantReq.LogSearchConfiguration.StorageSize != nil { - diskSpaceFromAPI = int64(*tenantReq.LogSearchConfiguration.StorageSize) * humanize.GiByte - } - if tenantReq.LogSearchConfiguration.StorageClass != "" { - logSearchStorageClass = stringPtr(tenantReq.LogSearchConfiguration.StorageClass) - } - if tenantReq.LogSearchConfiguration.Image != "" { - logSearchImage = tenantReq.LogSearchConfiguration.Image - } - if tenantReq.LogSearchConfiguration.PostgresImage != "" { - logSearchPgImage = tenantReq.LogSearchConfiguration.PostgresImage - } - if tenantReq.LogSearchConfiguration.PostgresInitImage != "" { - logSearchPgInitImage = tenantReq.LogSearchConfiguration.PostgresInitImage - } - // if security context for logSearch is present, configure it. - if tenantReq.LogSearchConfiguration.SecurityContext != nil { - sc, err := convertModelSCToK8sSC(tenantReq.LogSearchConfiguration.SecurityContext) - if err != nil { - return minInst, err - } - logSearchSecurityContext = sc - } - // if security context for logSearch is present, configure it. - if tenantReq.LogSearchConfiguration.PostgresSecurityContext != nil { - sc, err := convertModelSCToK8sSC(tenantReq.LogSearchConfiguration.PostgresSecurityContext) - if err != nil { - return minInst, err - } - logSearchPgSecurityContext = sc - } - - logSearchDiskSpace := resource.NewQuantity(diskSpaceFromAPI, resource.DecimalExponent) - - // the audit max cap cannot be larger than disk size on the DB, else it won't trim the data - auditMaxCap := 10 - if (diskSpaceFromAPI / humanize.GiByte) < int64(auditMaxCap) { - auditMaxCap = int(diskSpaceFromAPI / humanize.GiByte) - } - - // default activate lgo search and prometheus - minInst.Spec.Log = &miniov2.LogConfig{ - Audit: &miniov2.AuditConfig{DiskCapacityGB: swag.Int(auditMaxCap)}, - Db: &miniov2.LogDbConfig{ - VolumeClaimTemplate: &corev1.PersistentVolumeClaim{ - ObjectMeta: metav1.ObjectMeta{ - Name: *tenantReq.Name + "-log", - }, - Spec: corev1.PersistentVolumeClaimSpec{ - AccessModes: []corev1.PersistentVolumeAccessMode{ - corev1.ReadWriteOnce, - }, - Resources: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - corev1.ResourceStorage: *logSearchDiskSpace, - }, - }, - StorageClassName: logSearchStorageClass, - }, - }, - }, - } - // set log search images if any - if logSearchImage != "" { - minInst.Spec.Log.Image = logSearchImage - } - if logSearchPgImage != "" { - minInst.Spec.Log.Db.Image = logSearchPgImage - } - if logSearchPgInitImage != "" { - minInst.Spec.Log.Db.InitImage = logSearchPgInitImage - } - if logSearchSecurityContext != nil { - minInst.Spec.Log.SecurityContext = logSearchSecurityContext - } - if logSearchPgSecurityContext != nil { - minInst.Spec.Log.Db.SecurityContext = logSearchPgSecurityContext - } - return minInst, nil -} - -func setTenantPrometheusConfig(ctx context.Context, tenantReq *models.CreateTenantRequest, minInst miniov2.Tenant) (miniov2.Tenant, error) { - prometheusDiskSpace := 5 // Default is 5 by API - prometheusImage := "" // Default is "" - prometheusSidecardImage := "" // Default is "" - prometheusInitImage := "" // Default is "" - - var prometheusStorageClass *string // Nil means default storage class - - if tenantReq.PrometheusConfiguration.StorageSize != nil { - prometheusDiskSpace = int(*tenantReq.PrometheusConfiguration.StorageSize) - } - if tenantReq.PrometheusConfiguration.StorageClass != "" { - prometheusStorageClass = stringPtr(tenantReq.PrometheusConfiguration.StorageClass) - } - if tenantReq.PrometheusConfiguration.Image != "" { - prometheusImage = tenantReq.PrometheusConfiguration.Image - } - if tenantReq.PrometheusConfiguration.SidecarImage != "" { - prometheusSidecardImage = tenantReq.PrometheusConfiguration.SidecarImage - } - if tenantReq.PrometheusConfiguration.InitImage != "" { - prometheusInitImage = tenantReq.PrometheusConfiguration.InitImage - } - - minInst.Spec.Prometheus = &miniov2.PrometheusConfig{ - DiskCapacityDB: swag.Int(prometheusDiskSpace), - StorageClassName: prometheusStorageClass, - } - if prometheusImage != "" { - minInst.Spec.Prometheus.Image = prometheusImage - } - if prometheusSidecardImage != "" { - minInst.Spec.Prometheus.SideCarImage = prometheusSidecardImage - } - if prometheusInitImage != "" { - minInst.Spec.Prometheus.InitImage = prometheusInitImage - } - // if security context for prometheus is present, configure it. - if tenantReq.PrometheusConfiguration != nil && tenantReq.PrometheusConfiguration.SecurityContext != nil { - sc, err := convertModelSCToK8sSC(tenantReq.PrometheusConfiguration.SecurityContext) - if err != nil { - return minInst, err - } - minInst.Spec.Prometheus.SecurityContext = sc - } - return minInst, nil -} diff --git a/operatorapi/tenant_get.go b/operatorapi/tenant_get.go deleted file mode 100644 index fcea5f263..000000000 --- a/operatorapi/tenant_get.go +++ /dev/null @@ -1,158 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2022 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "fmt" - - errors "github.com/minio/console/restapi" - - "github.com/minio/console/cluster" - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations/operator_api" - miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func getTenantDetailsResponse(session *models.Principal, params operator_api.TenantDetailsParams) (*models.Tenant, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return nil, errors.ErrorWithContext(ctx, err) - } - - opClient := &operatorClient{ - client: opClientClientSet, - } - - minTenant, err := getTenant(ctx, opClient, params.Namespace, params.Tenant) - if err != nil { - return nil, errors.ErrorWithContext(ctx, err) - } - - info := getTenantInfo(minTenant) - - // get Kubernetes Client - clientSet, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, errors.ErrorWithContext(ctx, err) - } - - k8sClient := k8sClient{ - client: clientSet, - } - - tenantConfiguration, err := GetTenantConfiguration(ctx, &k8sClient, minTenant) - if err != nil { - errors.LogError("unable to fetch configuration for tenant %s: %v", minTenant.Name, err) - } - - // detect if AD/LDAP is enabled - ldapEnabled := tenantConfiguration["MINIO_IDENTITY_LDAP_SERVER_ADDR"] != "" - - // detect if OpenID is enabled - oidcEnabled := tenantConfiguration["MINIO_IDENTITY_OPENID_CONFIG_URL"] != "" - - // detect if encryption is enabled - info.EncryptionEnabled = minTenant.HasKESEnabled() || tenantConfiguration["MINIO_KMS_SECRET_KEY"] != "" - info.LogEnabled = minTenant.HasLogSearchAPIEnabled() - info.MonitoringEnabled = minTenant.HasPrometheusEnabled() - info.IdpAdEnabled = ldapEnabled - info.IdpOidcEnabled = oidcEnabled - info.MinioTLS = minTenant.TLS() - - // attach status information - info.Status = &models.TenantStatus{ - HealthStatus: string(minTenant.Status.HealthStatus), - DrivesHealing: minTenant.Status.DrivesHealing, - DrivesOffline: minTenant.Status.DrivesOffline, - DrivesOnline: minTenant.Status.DrivesOnline, - WriteQuorum: minTenant.Status.WriteQuorum, - Usage: &models.TenantStatusUsage{ - Raw: minTenant.Status.Usage.RawCapacity, - RawUsage: minTenant.Status.Usage.RawUsage, - Capacity: minTenant.Status.Usage.Capacity, - CapacityUsage: minTenant.Status.Usage.Usage, - }, - } - - // get tenant service - minTenant.EnsureDefaults() - // minio service - minSvc, err := k8sClient.getService(ctx, minTenant.Namespace, minTenant.MinIOCIServiceName(), metav1.GetOptions{}) - if err != nil { - // we can tolerate this errors - errors.LogError("Unable to get MinIO service name: %v, continuing", err) - } - // console service - conSvc, err := k8sClient.getService(ctx, minTenant.Namespace, minTenant.ConsoleCIServiceName(), metav1.GetOptions{}) - if err != nil { - // we can tolerate this errors - errors.LogError("Unable to get MinIO console service name: %v, continuing", err) - } - - schema := "http" - consoleSchema := schema - consolePort := fmt.Sprintf(":%d", miniov2.ConsolePort) - if minTenant.TLS() { - schema = "https" - consoleSchema = schema - consolePort = fmt.Sprintf(":%d", miniov2.ConsoleTLSPort) - } - - var minioEndpoint string - var consoleEndpoint string - if minSvc != nil && len(minSvc.Status.LoadBalancer.Ingress) > 0 { - if minSvc.Status.LoadBalancer.Ingress[0].IP != "" { - minioEndpoint = fmt.Sprintf("%s://%s", schema, minSvc.Status.LoadBalancer.Ingress[0].IP) - } - - if minSvc.Status.LoadBalancer.Ingress[0].Hostname != "" { - minioEndpoint = fmt.Sprintf("%s://%s", schema, minSvc.Status.LoadBalancer.Ingress[0].Hostname) - } - - } - - if conSvc != nil && len(conSvc.Status.LoadBalancer.Ingress) > 0 { - if conSvc.Status.LoadBalancer.Ingress[0].IP != "" { - consoleEndpoint = fmt.Sprintf("%s://%s%s", consoleSchema, conSvc.Status.LoadBalancer.Ingress[0].IP, consolePort) - } - if conSvc.Status.LoadBalancer.Ingress[0].Hostname != "" { - consoleEndpoint = fmt.Sprintf("%s://%s%s", consoleSchema, conSvc.Status.LoadBalancer.Ingress[0].Hostname, consolePort) - } - } - - info.Endpoints = &models.TenantEndpoints{ - Console: consoleEndpoint, - Minio: minioEndpoint, - } - - var domains models.DomainsConfiguration - - if minTenant.Spec.Features != nil && minTenant.Spec.Features.Domains != nil { - domains = models.DomainsConfiguration{ - Console: minTenant.Spec.Features.Domains.Console, - Minio: minTenant.Spec.Features.Domains.Minio, - } - } - - info.Domains = &domains - - return info, nil -} diff --git a/operatorapi/tenant_logs_handlers.go b/operatorapi/tenant_logs_handlers.go deleted file mode 100644 index f072c5793..000000000 --- a/operatorapi/tenant_logs_handlers.go +++ /dev/null @@ -1,467 +0,0 @@ -package operatorapi - -import ( - "context" - "fmt" - "reflect" - "strconv" - - "github.com/dustin/go-humanize" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/swag" - "github.com/minio/console/cluster" - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations" - "github.com/minio/console/operatorapi/operations/operator_api" - "github.com/minio/console/restapi" - miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func registerTenantLogsHandlers(api *operations.OperatorAPI) { - api.OperatorAPIGetTenantLogsHandler = operator_api.GetTenantLogsHandlerFunc(func(params operator_api.GetTenantLogsParams, session *models.Principal) middleware.Responder { - payload, err := getTenantLogsResponse(session, params) - if err != nil { - return operator_api.NewGetTenantLogsDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewGetTenantLogsOK().WithPayload(payload) - }) - - api.OperatorAPISetTenantLogsHandler = operator_api.SetTenantLogsHandlerFunc(func(params operator_api.SetTenantLogsParams, session *models.Principal) middleware.Responder { - payload, err := setTenantLogsResponse(session, params) - if err != nil { - return operator_api.NewSetTenantLogsDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewSetTenantLogsOK().WithPayload(payload) - }) - - api.OperatorAPIEnableTenantLoggingHandler = operator_api.EnableTenantLoggingHandlerFunc(func(params operator_api.EnableTenantLoggingParams, session *models.Principal) middleware.Responder { - payload, err := enableTenantLoggingResponse(session, params) - if err != nil { - return operator_api.NewEnableTenantLoggingDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewEnableTenantLoggingOK().WithPayload(payload) - }) - - api.OperatorAPIDisableTenantLoggingHandler = operator_api.DisableTenantLoggingHandlerFunc(func(params operator_api.DisableTenantLoggingParams, session *models.Principal) middleware.Responder { - payload, err := disableTenantLoggingResponse(session, params) - if err != nil { - return operator_api.NewDisableTenantLoggingDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewDisableTenantLoggingOK().WithPayload(payload) - }) -} - -// getTenantLogsResponse returns the Audit Log and Log DB configuration of a tenant -func getTenantLogsResponse(session *models.Principal, params operator_api.GetTenantLogsParams) (*models.TenantLogs, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err, restapi.ErrUnableToGetTenantLogs) - } - - opClient := &operatorClient{ - client: opClientClientSet, - } - - minTenant, err := getTenant(ctx, opClient, params.Namespace, params.Tenant) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err, restapi.ErrUnableToGetTenantLogs) - } - return getTenantLogsInfo(minTenant), nil -} - -func getTenantLogsInfo(minTenant *miniov2.Tenant) *models.TenantLogs { - if minTenant.Spec.Log == nil { - return &models.TenantLogs{ - Disabled: true, - } - } - annotations := []*models.Annotation{} - for k, v := range minTenant.Spec.Log.Annotations { - annotations = append(annotations, &models.Annotation{Key: k, Value: v}) - } - labels := []*models.Label{} - for k, v := range minTenant.Spec.Log.Labels { - labels = append(labels, &models.Label{Key: k, Value: v}) - } - nodeSelector := []*models.NodeSelector{} - for k, v := range minTenant.Spec.Log.NodeSelector { - nodeSelector = append(nodeSelector, &models.NodeSelector{Key: k, Value: v}) - } - if minTenant.Spec.Log.Db == nil { - minTenant.Spec.Log.Db = &miniov2.LogDbConfig{} - } - dbAnnotations := []*models.Annotation{} - for k, v := range minTenant.Spec.Log.Db.Annotations { - dbAnnotations = append(dbAnnotations, &models.Annotation{Key: k, Value: v}) - } - dbLabels := []*models.Label{} - for k, v := range minTenant.Spec.Log.Db.Labels { - dbLabels = append(dbLabels, &models.Label{Key: k, Value: v}) - } - dbNodeSelector := []*models.NodeSelector{} - for k, v := range minTenant.Spec.Log.Db.NodeSelector { - dbNodeSelector = append(dbNodeSelector, &models.NodeSelector{Key: k, Value: v}) - } - var logSecurityContext *models.SecurityContext - var logDBSecurityContext *models.SecurityContext - - if minTenant.Spec.Log.SecurityContext != nil { - logSecurityContext = convertK8sSCToModelSC(minTenant.Spec.Log.SecurityContext) - } - if minTenant.Spec.Log.Db.SecurityContext != nil { - logDBSecurityContext = convertK8sSCToModelSC(minTenant.Spec.Log.Db.SecurityContext) - } - - if minTenant.Spec.Log.Audit == nil || minTenant.Spec.Log.Audit.DiskCapacityGB == nil { - minTenant.Spec.Log.Audit = &miniov2.AuditConfig{DiskCapacityGB: swag.Int(0)} - } - - tenantLoggingConfiguration := &models.TenantLogs{ - Image: minTenant.Spec.Log.Image, - DiskCapacityGB: fmt.Sprintf("%d", *minTenant.Spec.Log.Audit.DiskCapacityGB), - Annotations: annotations, - Labels: labels, - NodeSelector: nodeSelector, - ServiceAccountName: minTenant.Spec.Log.ServiceAccountName, - SecurityContext: logSecurityContext, - DbImage: minTenant.Spec.Log.Db.Image, - DbInitImage: minTenant.Spec.Log.Db.InitImage, - DbAnnotations: dbAnnotations, - DbLabels: dbLabels, - DbNodeSelector: dbNodeSelector, - DbServiceAccountName: minTenant.Spec.Log.Db.ServiceAccountName, - DbSecurityContext: logDBSecurityContext, - Disabled: false, - } - - var requestedCPU string - var requestedMem string - var requestedDBCPU string - var requestedDBMem string - - if minTenant.Spec.Log.Resources.Requests != nil { - requestedCPUQ := minTenant.Spec.Log.Resources.Requests["cpu"] - requestedCPU = strconv.FormatInt(requestedCPUQ.Value(), 10) - requestedMemQ := minTenant.Spec.Log.Resources.Requests["memory"] - requestedMem = strconv.FormatInt(requestedMemQ.Value(), 10) - - requestedDBCPUQ := minTenant.Spec.Log.Db.Resources.Requests["cpu"] - requestedDBCPU = strconv.FormatInt(requestedDBCPUQ.Value(), 10) - requestedDBMemQ := minTenant.Spec.Log.Db.Resources.Requests["memory"] - requestedDBMem = strconv.FormatInt(requestedDBMemQ.Value(), 10) - - tenantLoggingConfiguration.LogCPURequest = requestedCPU - tenantLoggingConfiguration.LogMemRequest = requestedMem - tenantLoggingConfiguration.LogDBCPURequest = requestedDBCPU - tenantLoggingConfiguration.LogDBMemRequest = requestedDBMem - } - return tenantLoggingConfiguration -} - -// setTenantLogsResponse updates the Audit Log and Log DB configuration for the tenant -func setTenantLogsResponse(session *models.Principal, params operator_api.SetTenantLogsParams) (bool, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err, restapi.ErrUnableToGetTenantUsage) - } - - opClient := &operatorClient{ - client: opClientClientSet, - } - - minTenant, err := getTenant(ctx, opClient, params.Namespace, params.Tenant) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err, restapi.ErrUnableToGetTenantUsage) - } - return setTenantLogs(ctx, minTenant, opClient, params) -} - -func setTenantLogs(ctx context.Context, minTenant *miniov2.Tenant, opClient OperatorClientI, params operator_api.SetTenantLogsParams) (bool, *models.Error) { - var err error - labels := make(map[string]string) - if params.Data.Labels != nil { - for i := 0; i < len(params.Data.Labels); i++ { - if params.Data.Labels[i] != nil { - labels[params.Data.Labels[i].Key] = params.Data.Labels[i].Value - } - } - minTenant.Spec.Log.Labels = labels - } - - if params.Data.Annotations != nil { - annotations := make(map[string]string) - for i := 0; i < len(params.Data.Annotations); i++ { - if params.Data.Annotations[i] != nil { - annotations[params.Data.Annotations[i].Key] = params.Data.Annotations[i].Value - } - } - minTenant.Spec.Log.Annotations = annotations - } - if params.Data.NodeSelector != nil { - nodeSelector := make(map[string]string) - for i := 0; i < len(params.Data.NodeSelector); i++ { - if params.Data.NodeSelector[i] != nil { - nodeSelector[params.Data.NodeSelector[i].Key] = params.Data.NodeSelector[i].Value - } - } - minTenant.Spec.Log.NodeSelector = nodeSelector - } - logResourceRequest := make(corev1.ResourceList) - if len(params.Data.LogCPURequest) > 0 { - if reflect.TypeOf(params.Data.LogCPURequest).Kind() == reflect.String && params.Data.LogCPURequest != "0Gi" && params.Data.LogCPURequest != "" { - cpuQuantity, err := resource.ParseQuantity(params.Data.LogCPURequest) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err) - } - logResourceRequest["cpu"] = cpuQuantity - minTenant.Spec.Log.Resources.Requests = logResourceRequest - } - } - if len(params.Data.LogMemRequest) > 0 { - if reflect.TypeOf(params.Data.LogMemRequest).Kind() == reflect.String && params.Data.LogMemRequest != "" { - memQuantity, err := resource.ParseQuantity(params.Data.LogMemRequest) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err) - } - - logResourceRequest["memory"] = memQuantity - minTenant.Spec.Log.Resources.Requests = logResourceRequest - } - } - - modified := false - if minTenant.Spec.Log.Db != nil { - modified = true - } - dbLabels := make(map[string]string) - if params.Data.DbLabels != nil { - for i := 0; i < len(params.Data.DbLabels); i++ { - if params.Data.DbLabels[i] != nil { - dbLabels[params.Data.DbLabels[i].Key] = params.Data.DbLabels[i].Value - } - modified = true - } - } - dbAnnotations := make(map[string]string) - if params.Data.DbAnnotations != nil { - for i := 0; i < len(params.Data.DbAnnotations); i++ { - if params.Data.DbAnnotations[i] != nil { - dbAnnotations[params.Data.DbAnnotations[i].Key] = params.Data.DbAnnotations[i].Value - } - modified = true - } - } - dbNodeSelector := make(map[string]string) - if params.Data.DbNodeSelector != nil { - for i := 0; i < len(params.Data.DbNodeSelector); i++ { - if params.Data.DbNodeSelector[i] != nil { - dbNodeSelector[params.Data.DbNodeSelector[i].Key] = params.Data.DbNodeSelector[i].Value - } - modified = true - } - } - logDBResourceRequest := make(corev1.ResourceList) - if len(params.Data.LogDBCPURequest) > 0 { - if reflect.TypeOf(params.Data.LogDBCPURequest).Kind() == reflect.String && params.Data.LogDBCPURequest != "0Gi" && params.Data.LogDBCPURequest != "" { - dbCPUQuantity, err := resource.ParseQuantity(params.Data.LogDBCPURequest) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err) - } - logDBResourceRequest["cpu"] = dbCPUQuantity - minTenant.Spec.Log.Db.Resources.Requests = logDBResourceRequest - } - } - if len(params.Data.LogDBMemRequest) > 0 { - if reflect.TypeOf(params.Data.LogDBMemRequest).Kind() == reflect.String && params.Data.LogDBMemRequest != "" { - dbMemQuantity, err := resource.ParseQuantity(params.Data.LogDBMemRequest) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err) - } - logDBResourceRequest["memory"] = dbMemQuantity - minTenant.Spec.Log.Db.Resources.Requests = logDBResourceRequest - } - } - if len(params.Data.Image) > 0 { - minTenant.Spec.Log.Image = params.Data.Image - } - if params.Data.SecurityContext != nil { - minTenant.Spec.Log.SecurityContext, err = convertModelSCToK8sSC(params.Data.SecurityContext) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err) - } - } - if len(params.Data.DiskCapacityGB) > 0 { - diskCapacityGB, err := strconv.Atoi(params.Data.DiskCapacityGB) - if err == nil { - if minTenant.Spec.Log.Audit != nil && minTenant.Spec.Log.Audit.DiskCapacityGB != nil { - *minTenant.Spec.Log.Audit.DiskCapacityGB = diskCapacityGB - } else { - minTenant.Spec.Log.Audit = &miniov2.AuditConfig{DiskCapacityGB: swag.Int(diskCapacityGB)} - } - } - } - if len(params.Data.ServiceAccountName) > 0 { - minTenant.Spec.Log.ServiceAccountName = params.Data.ServiceAccountName - } - if params.Data.DbLabels != nil { - - if params.Data.DbImage != "" || params.Data.DbServiceAccountName != "" { - modified = true - } - if modified { - if minTenant.Spec.Log.Db == nil { - // Default class name for Log search - diskSpaceFromAPI := int64(5) * humanize.GiByte // Default is 5Gi - logSearchStorageClass := "standard" - - logSearchDiskSpace := resource.NewQuantity(diskSpaceFromAPI, resource.DecimalExponent) - resources := corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - corev1.ResourceStorage: *logSearchDiskSpace, - }, - } - minTenant.Spec.Log.Db = &miniov2.LogDbConfig{ - VolumeClaimTemplate: &corev1.PersistentVolumeClaim{ - ObjectMeta: metav1.ObjectMeta{ - Name: params.Tenant + "-log", - }, - Spec: corev1.PersistentVolumeClaimSpec{ - AccessModes: []corev1.PersistentVolumeAccessMode{ - corev1.ReadWriteOnce, - }, - Resources: resources, - StorageClassName: &logSearchStorageClass, - }, - }, - Labels: dbLabels, - Annotations: dbAnnotations, - NodeSelector: dbNodeSelector, - Image: params.Data.DbImage, - ServiceAccountName: params.Data.DbServiceAccountName, - Resources: corev1.ResourceRequirements{ - Requests: resources.Requests, - }, - } - } else { - minTenant.Spec.Log.Db.Labels = dbLabels - minTenant.Spec.Log.Db.Annotations = dbAnnotations - minTenant.Spec.Log.Db.NodeSelector = dbNodeSelector - minTenant.Spec.Log.Db.Image = params.Data.DbImage - minTenant.Spec.Log.Db.InitImage = params.Data.DbInitImage - minTenant.Spec.Log.Db.ServiceAccountName = params.Data.DbServiceAccountName - minTenant.Spec.Log.Db.SecurityContext, err = convertModelSCToK8sSC(params.Data.DbSecurityContext) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err) - } - } - } - } - - _, err = opClient.TenantUpdate(ctx, minTenant, metav1.UpdateOptions{}) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err) - } - return true, nil -} - -// enableTenantLoggingResponse enables Tenant Logging -func enableTenantLoggingResponse(session *models.Principal, params operator_api.EnableTenantLoggingParams) (bool, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err, restapi.ErrUnableToGetTenantUsage) - } - - opClient := &operatorClient{ - client: opClientClientSet, - } - - minTenant, err := getTenant(ctx, opClient, params.Namespace, params.Tenant) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err, restapi.ErrUnableToGetTenantUsage) - } - return enableTenantLogging(ctx, minTenant, opClient, params.Tenant) -} - -func enableTenantLogging(ctx context.Context, minTenant *miniov2.Tenant, opClient OperatorClientI, tenantName string) (bool, *models.Error) { - minTenant.EnsureDefaults() - // Default class name for Log search - diskSpaceFromAPI := int64(5) * humanize.GiByte // Default is 5Gi - logSearchStorageClass := "standard" - - logSearchDiskSpace := resource.NewQuantity(diskSpaceFromAPI, resource.DecimalExponent) - - auditMaxCap := 10 - if (diskSpaceFromAPI / humanize.GiByte) < int64(auditMaxCap) { - auditMaxCap = int(diskSpaceFromAPI / humanize.GiByte) - } - - minTenant.Spec.Log = &miniov2.LogConfig{ - Audit: &miniov2.AuditConfig{DiskCapacityGB: swag.Int(auditMaxCap)}, - Db: &miniov2.LogDbConfig{ - VolumeClaimTemplate: &corev1.PersistentVolumeClaim{ - ObjectMeta: metav1.ObjectMeta{ - Name: tenantName + "-log", - }, - Spec: corev1.PersistentVolumeClaimSpec{ - AccessModes: []corev1.PersistentVolumeAccessMode{ - corev1.ReadWriteOnce, - }, - Resources: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - corev1.ResourceStorage: *logSearchDiskSpace, - }, - }, - StorageClassName: &logSearchStorageClass, - }, - }, - }, - } - - _, err := opClient.TenantUpdate(ctx, minTenant, metav1.UpdateOptions{}) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err) - } - return true, nil -} - -// disableTenantLoggingResponse disables Tenant Logging -func disableTenantLoggingResponse(session *models.Principal, params operator_api.DisableTenantLoggingParams) (bool, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err, restapi.ErrUnableToGetTenantUsage) - } - if err != nil { - return false, restapi.ErrorWithContext(ctx, err, restapi.ErrUnableToGetTenantUsage) - } - - opClient := &operatorClient{ - client: opClientClientSet, - } - - minTenant, err := getTenant(ctx, opClient, params.Namespace, params.Tenant) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err, restapi.ErrUnableToGetTenantUsage) - } - minTenant.EnsureDefaults() - minTenant.Spec.Log = nil - - _, err = opClient.TenantUpdate(ctx, minTenant, metav1.UpdateOptions{}) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err) - } - return true, nil -} diff --git a/operatorapi/tenant_logs_handlers_test.go b/operatorapi/tenant_logs_handlers_test.go deleted file mode 100644 index b0556e195..000000000 --- a/operatorapi/tenant_logs_handlers_test.go +++ /dev/null @@ -1,331 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "errors" - "net/http" - "testing" - - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations" - "github.com/minio/console/operatorapi/operations/operator_api" - miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/suite" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -type TenantLogsTestSuite struct { - suite.Suite - assert *assert.Assertions - opClient opClientMock -} - -func (suite *TenantLogsTestSuite) SetupSuite() { - suite.assert = assert.New(suite.T()) - suite.opClient = opClientMock{} -} - -func (suite *TenantLogsTestSuite) SetupTest() { -} - -func (suite *TenantLogsTestSuite) TearDownSuite() { -} - -func (suite *TenantLogsTestSuite) TearDownTest() { -} - -func (suite *TenantLogsTestSuite) TestRegisterTenantLogsHandlers() { - api := &operations.OperatorAPI{} - suite.assertHandlersAreNil(api) - registerTenantLogsHandlers(api) - suite.assertHandlersAreNotNil(api) -} - -func (suite *TenantLogsTestSuite) assertHandlersAreNil(api *operations.OperatorAPI) { - suite.assert.Nil(api.OperatorAPIGetTenantLogsHandler) - suite.assert.Nil(api.OperatorAPISetTenantLogsHandler) - suite.assert.Nil(api.OperatorAPIEnableTenantLoggingHandler) - suite.assert.Nil(api.OperatorAPIDisableTenantLoggingHandler) -} - -func (suite *TenantLogsTestSuite) assertHandlersAreNotNil(api *operations.OperatorAPI) { - suite.assert.NotNil(api.OperatorAPIGetTenantLogsHandler) - suite.assert.NotNil(api.OperatorAPISetTenantLogsHandler) - suite.assert.NotNil(api.OperatorAPIEnableTenantLoggingHandler) - suite.assert.NotNil(api.OperatorAPIDisableTenantLoggingHandler) -} - -func (suite *TenantLogsTestSuite) TestGetTenantLogsHandlerWithError() { - params, api := suite.initGetTenantLogsRequest() - response := api.OperatorAPIGetTenantLogsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.GetTenantLogsDefault) - suite.assert.True(ok) -} - -func (suite *TenantLogsTestSuite) initGetTenantLogsRequest() (params operator_api.GetTenantLogsParams, api operations.OperatorAPI) { - registerTenantLogsHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-name" - return params, api -} - -func (suite *TenantLogsTestSuite) TestGetTenantLogsInfoWithoutLogAndNoError() { - tenant := suite.createMockTenant(false, true) - tenantLogs := getTenantLogsInfo(tenant) - suite.assert.True(tenantLogs.Disabled) -} - -func (suite *TenantLogsTestSuite) TestGetTenantLogsInfoWithLogAndNoError() { - tenant := suite.createMockTenant(true, true) - tenantLogs := getTenantLogsInfo(tenant) - suite.assert.False(tenantLogs.Disabled) - suite.assert.NotNil(tenantLogs.Labels) - suite.assert.NotNil(tenantLogs.Annotations) -} - -func (suite *TenantLogsTestSuite) TestSetTenantLogsWithoutError() { - opClientTenantUpdateMock = func(ctx context.Context, tenant *miniov2.Tenant, opts metav1.UpdateOptions) (*miniov2.Tenant, error) { - return tenant, nil - } - tenant := suite.createMockTenant(true, true) - success, err := setTenantLogs(context.Background(), tenant, suite.opClient, suite.createMockParams()) - suite.assert.True(success) - suite.assert.Nil(err) -} - -func (suite *TenantLogsTestSuite) TestSetTenantLogsWithoutDBAndError() { - opClientTenantUpdateMock = func(ctx context.Context, tenant *miniov2.Tenant, opts metav1.UpdateOptions) (*miniov2.Tenant, error) { - return tenant, nil - } - tenant := suite.createMockTenant(true, false) - params := suite.createMockParams() - params.Data.LogDBCPURequest = "" - params.Data.LogDBMemRequest = "" - success, err := setTenantLogs(context.Background(), tenant, suite.opClient, params) - suite.assert.True(success) - suite.assert.Nil(err) -} - -func (suite *TenantLogsTestSuite) TestSetTenantLogsWithError() { - opClientTenantUpdateMock = func(ctx context.Context, tenant *miniov2.Tenant, opts metav1.UpdateOptions) (*miniov2.Tenant, error) { - return nil, errors.New("mock-error") - } - tenant := suite.createMockTenant(true, true) - success, err := setTenantLogs(context.Background(), tenant, suite.opClient, suite.createMockParams()) - suite.assert.False(success) - suite.assert.NotNil(err) -} - -func (suite *TenantLogsTestSuite) TestEnableTenantLoggingWithoutError() { - opClientTenantUpdateMock = func(ctx context.Context, tenant *miniov2.Tenant, opts metav1.UpdateOptions) (*miniov2.Tenant, error) { - return tenant, nil - } - tenant := suite.createMockTenant(true, true) - success, err := enableTenantLogging(context.Background(), tenant, suite.opClient, "mock-tenant") - suite.assert.True(success) - suite.assert.Nil(err) -} - -func (suite *TenantLogsTestSuite) TestEnableTenantLoggingWithError() { - opClientTenantUpdateMock = func(ctx context.Context, tenant *miniov2.Tenant, opts metav1.UpdateOptions) (*miniov2.Tenant, error) { - return nil, errors.New("mock-error") - } - tenant := suite.createMockTenant(true, true) - success, err := enableTenantLogging(context.Background(), tenant, suite.opClient, "mock-tenant") - suite.assert.False(success) - suite.assert.NotNil(err) -} - -func (suite *TenantLogsTestSuite) createMockParams() operator_api.SetTenantLogsParams { - runAsUser := "1000" - runAsGroup := "1000" - fsGroup := "1000" - return operator_api.SetTenantLogsParams{ - Data: &models.TenantLogs{ - Labels: []*models.Label{ - { - Key: "key", - Value: "value", - }, - }, - Annotations: []*models.Annotation{ - { - Key: "key", - Value: "value", - }, - }, - NodeSelector: []*models.NodeSelector{ - { - Key: "key", - Value: "value", - }, - }, - LogCPURequest: "5Gi", - LogMemRequest: "5Gi", - DbLabels: []*models.Label{ - { - Key: "key", - Value: "value", - }, - }, - DbAnnotations: []*models.Annotation{ - { - Key: "key", - Value: "value", - }, - }, - DbNodeSelector: []*models.NodeSelector{ - { - Key: "key", - Value: "value", - }, - }, - LogDBCPURequest: "5Gi", - LogDBMemRequest: "5Gi", - Image: "mock-image", - SecurityContext: &models.SecurityContext{ - RunAsUser: &runAsUser, - RunAsGroup: &runAsGroup, - FsGroup: fsGroup, - }, - DiskCapacityGB: "10", - ServiceAccountName: "mock-service-account-name", - DbImage: "mock-db-image", - DbSecurityContext: &models.SecurityContext{ - RunAsUser: &runAsUser, - RunAsGroup: &runAsGroup, - FsGroup: fsGroup, - }, - }, - } -} - -func (suite *TenantLogsTestSuite) createMockTenant(withSpecLog, withDB bool) *miniov2.Tenant { - cap := 10 - runAsUser := int64(1000) - runAsGroup := int64(1000) - fsGroup := int64(1000) - tenant := &miniov2.Tenant{} - if withSpecLog { - tenant.Spec.Log = &miniov2.LogConfig{ - Annotations: map[string]string{ - "key": "value", - }, - Labels: map[string]string{ - "key": "value", - }, - NodeSelector: map[string]string{ - "key": "value", - }, - Db: &miniov2.LogDbConfig{ - Annotations: map[string]string{ - "key": "value", - }, - Labels: map[string]string{ - "key": "value", - }, - NodeSelector: map[string]string{ - "key": "value", - }, - SecurityContext: &corev1.PodSecurityContext{ - RunAsUser: &runAsUser, - RunAsGroup: &runAsGroup, - FSGroup: &fsGroup, - }, - Resources: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - corev1.ResourceCPU: resource.MustParse("100m"), - corev1.ResourceMemory: resource.MustParse("100Mi"), - }, - }, - }, - SecurityContext: &corev1.PodSecurityContext{ - RunAsUser: &runAsUser, - RunAsGroup: &runAsGroup, - FSGroup: &fsGroup, - }, - Audit: &miniov2.AuditConfig{ - DiskCapacityGB: &cap, - }, - Resources: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - corev1.ResourceCPU: resource.MustParse("100m"), - corev1.ResourceMemory: resource.MustParse("100Mi"), - }, - }, - } - if !withDB { - tenant.Spec.Log.Db = nil - } - } - return tenant -} - -func (suite *TenantLogsTestSuite) TestSetTenantLogsHandlerWithError() { - params, api := suite.initSetTenantLogsRequest() - response := api.OperatorAPISetTenantLogsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.SetTenantLogsDefault) - suite.assert.True(ok) -} - -func (suite *TenantLogsTestSuite) initSetTenantLogsRequest() (params operator_api.SetTenantLogsParams, api operations.OperatorAPI) { - registerTenantLogsHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-name" - return params, api -} - -func (suite *TenantLogsTestSuite) TestEnableTenantLoggingHandlerWithError() { - params, api := suite.initEnableTenantLoggingRequest() - response := api.OperatorAPIEnableTenantLoggingHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.EnableTenantLoggingDefault) - suite.assert.True(ok) -} - -func (suite *TenantLogsTestSuite) initEnableTenantLoggingRequest() (params operator_api.EnableTenantLoggingParams, api operations.OperatorAPI) { - registerTenantLogsHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-name" - return params, api -} - -func (suite *TenantLogsTestSuite) TestDisableTenantLoggingHandlerWithError() { - params, api := suite.initDisableTenantLoggingRequest() - response := api.OperatorAPIDisableTenantLoggingHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.DisableTenantLoggingDefault) - suite.assert.True(ok) -} - -func (suite *TenantLogsTestSuite) initDisableTenantLoggingRequest() (params operator_api.DisableTenantLoggingParams, api operations.OperatorAPI) { - registerTenantLogsHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-name" - return params, api -} - -func TestTenantLogs(t *testing.T) { - suite.Run(t, new(TenantLogsTestSuite)) -} diff --git a/operatorapi/tenant_update.go b/operatorapi/tenant_update.go deleted file mode 100644 index 7e37420bd..000000000 --- a/operatorapi/tenant_update.go +++ /dev/null @@ -1,105 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2022 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "encoding/json" - "fmt" - "strings" - - "github.com/minio/console/restapi" - - "github.com/minio/console/pkg/http" - - "github.com/minio/console/operatorapi/operations/operator_api" - utils2 "github.com/minio/console/pkg/utils" - miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" -) - -// updateTenantAction does an update on the minioTenant by patching the desired changes -func updateTenantAction(ctx context.Context, operatorClient OperatorClientI, clientset K8sClientI, httpCl http.ClientI, namespace string, params operator_api.UpdateTenantParams) error { - imageToUpdate := params.Body.Image - imageRegistryReq := params.Body.ImageRegistry - - minInst, err := operatorClient.TenantGet(ctx, namespace, params.Tenant, metav1.GetOptions{}) - if err != nil { - return err - } - // we can take either the `image_pull_secret` of the `image_registry` but not both - if params.Body.ImagePullSecret != "" { - minInst.Spec.ImagePullSecret.Name = params.Body.ImagePullSecret - } else { - // update the image pull secret content - if _, err := setImageRegistry(ctx, imageRegistryReq, clientset, namespace, params.Tenant); err != nil { - restapi.LogError("error setting image registry secret: %v", err) - return err - } - } - - // if image to update is empty we'll use the latest image by default - if strings.TrimSpace(imageToUpdate) != "" { - minInst.Spec.Image = imageToUpdate - } else { - im, err := utils2.GetLatestMinIOImage(httpCl) - // if we can't get the MinIO image, we won' auto-update it unless it's explicit by name - if err == nil { - minInst.Spec.Image = *im - } - } - - // Prometheus Annotations - currentAnnotations := minInst.Annotations - prometheusAnnotations := map[string]string{ - prometheusPath: "/minio/prometheus/metrics", - prometheusPort: fmt.Sprint(miniov2.MinIOPort), - prometheusScrape: "true", - } - if params.Body.EnablePrometheus && currentAnnotations != nil { - // add prometheus annotations to the tenant - minInst.Annotations = addAnnotations(currentAnnotations, prometheusAnnotations) - // add prometheus annotations to the each pool - if minInst.Spec.Pools != nil { - for _, pool := range minInst.Spec.Pools { - poolAnnotations := pool.VolumeClaimTemplate.GetObjectMeta().GetAnnotations() - pool.VolumeClaimTemplate.GetObjectMeta().SetAnnotations(addAnnotations(poolAnnotations, prometheusAnnotations)) - } - } - } else { - // remove prometheus annotations to the tenant - minInst.Annotations = removeAnnotations(currentAnnotations, prometheusAnnotations) - // add prometheus annotations from each pool - if minInst.Spec.Pools != nil { - for _, pool := range minInst.Spec.Pools { - poolAnnotations := pool.VolumeClaimTemplate.GetObjectMeta().GetAnnotations() - pool.VolumeClaimTemplate.GetObjectMeta().SetAnnotations(removeAnnotations(poolAnnotations, prometheusAnnotations)) - } - } - } - - payloadBytes, err := json.Marshal(minInst) - if err != nil { - return err - } - _, err = operatorClient.TenantPatch(ctx, namespace, minInst.Name, types.MergePatchType, payloadBytes, metav1.PatchOptions{}) - if err != nil { - return err - } - return nil -} diff --git a/operatorapi/tenants.go b/operatorapi/tenants.go deleted file mode 100644 index 9c1998f47..000000000 --- a/operatorapi/tenants.go +++ /dev/null @@ -1,2810 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "bytes" - "context" - "crypto/x509" - "encoding/base64" - "encoding/json" - "encoding/pem" - "errors" - "fmt" - "net" - "sort" - "strconv" - "strings" - "time" - - utils2 "github.com/minio/console/pkg/http" - - "github.com/minio/madmin-go/v2" - - "github.com/minio/console/restapi" - - "github.com/minio/console/operatorapi/operations/operator_api" - - "github.com/minio/console/pkg/auth/utils" - - "k8s.io/apimachinery/pkg/api/resource" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/serializer" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/duration" - "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/utils/strings/slices" - - corev1 "k8s.io/api/core/v1" - - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/swag" - "github.com/minio/console/cluster" - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations" - miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - k8sErrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - k8sJson "k8s.io/apimachinery/pkg/runtime/serializer/json" - v1 "k8s.io/client-go/kubernetes/typed/core/v1" -) - -type imageRegistry struct { - Auths map[string]imageRegistryCredentials `json:"auths"` -} - -type imageRegistryCredentials struct { - Username string `json:"username"` - Password string `json:"password"` - Auth string `json:"auth"` -} - -func registerTenantHandlers(api *operations.OperatorAPI) { - // Add Tenant - api.OperatorAPICreateTenantHandler = operator_api.CreateTenantHandlerFunc(func(params operator_api.CreateTenantParams, session *models.Principal) middleware.Responder { - resp, err := getTenantCreatedResponse(session, params) - if err != nil { - return operator_api.NewCreateTenantDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewCreateTenantOK().WithPayload(resp) - }) - // List All Tenants of all namespaces - api.OperatorAPIListAllTenantsHandler = operator_api.ListAllTenantsHandlerFunc(func(params operator_api.ListAllTenantsParams, session *models.Principal) middleware.Responder { - resp, err := getListAllTenantsResponse(session, params) - if err != nil { - return operator_api.NewListTenantsDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewListTenantsOK().WithPayload(resp) - }) - // List Tenants by namespace - api.OperatorAPIListTenantsHandler = operator_api.ListTenantsHandlerFunc(func(params operator_api.ListTenantsParams, session *models.Principal) middleware.Responder { - resp, err := getListTenantsResponse(session, params) - if err != nil { - return operator_api.NewListTenantsDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewListTenantsOK().WithPayload(resp) - }) - // Detail Tenant - api.OperatorAPITenantDetailsHandler = operator_api.TenantDetailsHandlerFunc(func(params operator_api.TenantDetailsParams, session *models.Principal) middleware.Responder { - resp, err := getTenantDetailsResponse(session, params) - if err != nil { - return operator_api.NewTenantDetailsDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewTenantDetailsOK().WithPayload(resp) - }) - - // Tenant Configuration details - // Tenant Security details - api.OperatorAPITenantConfigurationHandler = operator_api.TenantConfigurationHandlerFunc(func(params operator_api.TenantConfigurationParams, session *models.Principal) middleware.Responder { - resp, err := getTenantConfigurationResponse(session, params) - if err != nil { - return operator_api.NewTenantConfigurationDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewTenantConfigurationOK().WithPayload(resp) - }) - // Update Tenant Configuration - api.OperatorAPIUpdateTenantConfigurationHandler = operator_api.UpdateTenantConfigurationHandlerFunc(func(params operator_api.UpdateTenantConfigurationParams, session *models.Principal) middleware.Responder { - err := getUpdateTenantConfigurationResponse(session, params) - if err != nil { - return operator_api.NewUpdateTenantConfigurationDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewUpdateTenantConfigurationNoContent() - }) - - // Tenant Security details - api.OperatorAPITenantSecurityHandler = operator_api.TenantSecurityHandlerFunc(func(params operator_api.TenantSecurityParams, session *models.Principal) middleware.Responder { - resp, err := getTenantSecurityResponse(session, params) - if err != nil { - return operator_api.NewTenantSecurityDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewTenantSecurityOK().WithPayload(resp) - }) - - // Update Tenant Security configuration - api.OperatorAPIUpdateTenantSecurityHandler = operator_api.UpdateTenantSecurityHandlerFunc(func(params operator_api.UpdateTenantSecurityParams, session *models.Principal) middleware.Responder { - err := getUpdateTenantSecurityResponse(session, params) - if err != nil { - return operator_api.NewUpdateTenantSecurityDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewUpdateTenantSecurityNoContent() - }) - - // Set Tenant Administrators - api.OperatorAPISetTenantAdministratorsHandler = operator_api.SetTenantAdministratorsHandlerFunc(func(params operator_api.SetTenantAdministratorsParams, session *models.Principal) middleware.Responder { - err := getSetTenantAdministratorsResponse(session, params) - if err != nil { - return operator_api.NewSetTenantAdministratorsDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewSetTenantAdministratorsNoContent() - }) - - // Tenant identity provider details - api.OperatorAPITenantIdentityProviderHandler = operator_api.TenantIdentityProviderHandlerFunc(func(params operator_api.TenantIdentityProviderParams, session *models.Principal) middleware.Responder { - resp, err := getTenantIdentityProviderResponse(session, params) - if err != nil { - return operator_api.NewTenantIdentityProviderDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewTenantIdentityProviderOK().WithPayload(resp) - }) - - // Update Tenant identity provider configuration - api.OperatorAPIUpdateTenantIdentityProviderHandler = operator_api.UpdateTenantIdentityProviderHandlerFunc(func(params operator_api.UpdateTenantIdentityProviderParams, session *models.Principal) middleware.Responder { - err := getUpdateTenantIdentityProviderResponse(session, params) - if err != nil { - return operator_api.NewUpdateTenantIdentityProviderDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewUpdateTenantIdentityProviderNoContent() - }) - - // Delete Tenant - api.OperatorAPIDeleteTenantHandler = operator_api.DeleteTenantHandlerFunc(func(params operator_api.DeleteTenantParams, session *models.Principal) middleware.Responder { - err := getDeleteTenantResponse(session, params) - if err != nil { - return operator_api.NewDeleteTenantDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewDeleteTenantNoContent() - }) - - // Delete Pod - api.OperatorAPIDeletePodHandler = operator_api.DeletePodHandlerFunc(func(params operator_api.DeletePodParams, session *models.Principal) middleware.Responder { - err := getDeletePodResponse(session, params) - if err != nil { - return operator_api.NewDeletePodDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewDeletePodNoContent() - }) - - // Update Tenant - api.OperatorAPIUpdateTenantHandler = operator_api.UpdateTenantHandlerFunc(func(params operator_api.UpdateTenantParams, session *models.Principal) middleware.Responder { - err := getUpdateTenantResponse(session, params) - if err != nil { - return operator_api.NewUpdateTenantDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewUpdateTenantCreated() - }) - - // Add Tenant Pools - api.OperatorAPITenantAddPoolHandler = operator_api.TenantAddPoolHandlerFunc(func(params operator_api.TenantAddPoolParams, session *models.Principal) middleware.Responder { - err := getTenantAddPoolResponse(session, params) - if err != nil { - return operator_api.NewTenantAddPoolDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewTenantAddPoolCreated() - }) - - // Get Tenant Usage - api.OperatorAPIGetTenantUsageHandler = operator_api.GetTenantUsageHandlerFunc(func(params operator_api.GetTenantUsageParams, session *models.Principal) middleware.Responder { - payload, err := getTenantUsageResponse(session, params) - if err != nil { - return operator_api.NewGetTenantUsageDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewGetTenantUsageOK().WithPayload(payload) - }) - - registerTenantLogsHandlers(api) - - api.OperatorAPIGetTenantPodsHandler = operator_api.GetTenantPodsHandlerFunc(func(params operator_api.GetTenantPodsParams, session *models.Principal) middleware.Responder { - payload, err := getTenantPodsResponse(session, params) - if err != nil { - return operator_api.NewGetTenantPodsDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewGetTenantPodsOK().WithPayload(payload) - }) - - api.OperatorAPIGetPodLogsHandler = operator_api.GetPodLogsHandlerFunc(func(params operator_api.GetPodLogsParams, session *models.Principal) middleware.Responder { - payload, err := getPodLogsResponse(session, params) - if err != nil { - return operator_api.NewGetPodLogsDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewGetPodLogsOK().WithPayload(payload) - }) - - api.OperatorAPIGetPodEventsHandler = operator_api.GetPodEventsHandlerFunc(func(params operator_api.GetPodEventsParams, session *models.Principal) middleware.Responder { - payload, err := getPodEventsResponse(session, params) - if err != nil { - return operator_api.NewGetPodEventsDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewGetPodEventsOK().WithPayload(payload) - }) - - api.OperatorAPIDescribePodHandler = operator_api.DescribePodHandlerFunc(func(params operator_api.DescribePodParams, session *models.Principal) middleware.Responder { - payload, err := getDescribePodResponse(session, params) - if err != nil { - return operator_api.NewDescribePodDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewDescribePodOK().WithPayload(payload) - }) - - // Get tenant monitoring info - api.OperatorAPIGetTenantMonitoringHandler = operator_api.GetTenantMonitoringHandlerFunc(func(params operator_api.GetTenantMonitoringParams, session *models.Principal) middleware.Responder { - payload, err := getTenantMonitoringResponse(session, params) - if err != nil { - return operator_api.NewGetTenantMonitoringDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewGetTenantMonitoringOK().WithPayload(payload) - }) - // Set configuration fields for Prometheus monitoring on a tenant - api.OperatorAPISetTenantMonitoringHandler = operator_api.SetTenantMonitoringHandlerFunc(func(params operator_api.SetTenantMonitoringParams, session *models.Principal) middleware.Responder { - _, err := setTenantMonitoringResponse(session, params) - if err != nil { - return operator_api.NewSetTenantMonitoringDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewSetTenantMonitoringCreated() - }) - - // Update Tenant Pools - api.OperatorAPITenantUpdatePoolsHandler = operator_api.TenantUpdatePoolsHandlerFunc(func(params operator_api.TenantUpdatePoolsParams, session *models.Principal) middleware.Responder { - resp, err := getTenantUpdatePoolResponse(session, params) - if err != nil { - return operator_api.NewTenantUpdatePoolsDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewTenantUpdatePoolsOK().WithPayload(resp) - }) - - // Update Tenant Certificates - api.OperatorAPITenantUpdateCertificateHandler = operator_api.TenantUpdateCertificateHandlerFunc(func(params operator_api.TenantUpdateCertificateParams, session *models.Principal) middleware.Responder { - err := getTenantUpdateCertificatesResponse(session, params) - if err != nil { - return operator_api.NewTenantUpdateCertificateDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewTenantUpdateCertificateCreated() - }) - - // Update Tenant Encryption Configuration - api.OperatorAPITenantUpdateEncryptionHandler = operator_api.TenantUpdateEncryptionHandlerFunc(func(params operator_api.TenantUpdateEncryptionParams, session *models.Principal) middleware.Responder { - err := getTenantUpdateEncryptionResponse(session, params) - if err != nil { - return operator_api.NewTenantUpdateEncryptionDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewTenantUpdateEncryptionCreated() - }) - - // Delete tenant Encryption Configuration - api.OperatorAPITenantDeleteEncryptionHandler = operator_api.TenantDeleteEncryptionHandlerFunc(func(params operator_api.TenantDeleteEncryptionParams, session *models.Principal) middleware.Responder { - err := getTenantDeleteEncryptionResponse(session, params) - if err != nil { - return operator_api.NewTenantDeleteEncryptionDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewTenantDeleteEncryptionNoContent() - }) - - // Get Tenant Encryption Configuration - api.OperatorAPITenantEncryptionInfoHandler = operator_api.TenantEncryptionInfoHandlerFunc(func(params operator_api.TenantEncryptionInfoParams, session *models.Principal) middleware.Responder { - configuration, err := getTenantEncryptionInfoResponse(session, params) - if err != nil { - return operator_api.NewTenantEncryptionInfoDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewTenantEncryptionInfoOK().WithPayload(configuration) - }) - - // Get Tenant YAML - api.OperatorAPIGetTenantYAMLHandler = operator_api.GetTenantYAMLHandlerFunc(func(params operator_api.GetTenantYAMLParams, principal *models.Principal) middleware.Responder { - payload, err := getTenantYAML(principal, params) - if err != nil { - return operator_api.NewGetTenantYAMLDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewGetTenantYAMLOK().WithPayload(payload) - }) - // Update Tenant YAML - api.OperatorAPIPutTenantYAMLHandler = operator_api.PutTenantYAMLHandlerFunc(func(params operator_api.PutTenantYAMLParams, principal *models.Principal) middleware.Responder { - err := getUpdateTenantYAML(principal, params) - if err != nil { - return operator_api.NewPutTenantYAMLDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewPutTenantYAMLCreated() - }) - // Get Tenant Events - api.OperatorAPIGetTenantEventsHandler = operator_api.GetTenantEventsHandlerFunc(func(params operator_api.GetTenantEventsParams, principal *models.Principal) middleware.Responder { - payload, err := getTenantEventsResponse(principal, params) - if err != nil { - return operator_api.NewGetTenantEventsDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewGetTenantEventsOK().WithPayload(payload) - }) - // Update Tenant Domains - api.OperatorAPIUpdateTenantDomainsHandler = operator_api.UpdateTenantDomainsHandlerFunc(func(params operator_api.UpdateTenantDomainsParams, principal *models.Principal) middleware.Responder { - err := getUpdateDomainsResponse(principal, params) - if err != nil { - return operator_api.NewUpdateTenantDomainsDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewUpdateTenantDomainsNoContent() - }) -} - -// getDeleteTenantResponse gets the output of deleting a minio instance -func getDeleteTenantResponse(session *models.Principal, params operator_api.DeleteTenantParams) *models.Error { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - // get Kubernetes Client - clientset, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - opClient := &operatorClient{ - client: opClientClientSet, - } - deleteTenantPVCs := false - if params.Body != nil { - deleteTenantPVCs = params.Body.DeletePvcs - } - - tenant, err := opClient.TenantGet(params.HTTPRequest.Context(), params.Namespace, params.Tenant, metav1.GetOptions{}) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - tenant.EnsureDefaults() - - if err = deleteTenantAction(params.HTTPRequest.Context(), opClient, clientset.CoreV1(), tenant, deleteTenantPVCs); err != nil { - return restapi.ErrorWithContext(ctx, err) - } - return nil -} - -// deleteTenantAction performs the actions of deleting a tenant -// -// It also adds the option of deleting the tenant's underlying pvcs if deletePvcs set -func deleteTenantAction( - ctx context.Context, - operatorClient OperatorClientI, - clientset v1.CoreV1Interface, - tenant *miniov2.Tenant, - deletePvcs bool, -) error { - err := operatorClient.TenantDelete(ctx, tenant.Namespace, tenant.Name, metav1.DeleteOptions{}) - if err != nil { - // try to delete pvc even if the tenant doesn't exist anymore but only if deletePvcs is set to true, - // else, we return the errors - if (deletePvcs && !k8sErrors.IsNotFound(err)) || !deletePvcs { - return err - } - } - - if deletePvcs { - - // delete MinIO PVCs - opts := metav1.ListOptions{ - LabelSelector: fmt.Sprintf("%s=%s", miniov2.TenantLabel, tenant.Name), - } - err = clientset.PersistentVolumeClaims(tenant.Namespace).DeleteCollection(ctx, metav1.DeleteOptions{}, opts) - if err != nil { - return err - } - // delete postgres PVCs - - logOpts := metav1.ListOptions{ - LabelSelector: fmt.Sprintf("%s=%s", miniov2.LogDBInstanceLabel, tenant.LogStatefulsetName()), - } - err := clientset.PersistentVolumeClaims(tenant.Namespace).DeleteCollection(ctx, metav1.DeleteOptions{}, logOpts) - if err != nil { - return err - } - - // delete prometheus PVCs - - promOpts := metav1.ListOptions{ - LabelSelector: fmt.Sprintf("%s=%s", miniov2.PrometheusInstanceLabel, tenant.PrometheusStatefulsetName()), - } - - if err := clientset.PersistentVolumeClaims(tenant.Namespace).DeleteCollection(ctx, metav1.DeleteOptions{}, promOpts); err != nil { - return err - } - - // delete all tenant's secrets only if deletePvcs = true - return clientset.Secrets(tenant.Namespace).DeleteCollection(ctx, metav1.DeleteOptions{}, opts) - } - return nil -} - -// getDeletePodResponse gets the output of deleting a minio instance -func getDeletePodResponse(session *models.Principal, params operator_api.DeletePodParams) *models.Error { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - // get Kubernetes Client - clientset, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - listOpts := metav1.ListOptions{ - LabelSelector: fmt.Sprintf("v1.min.io/tenant=%s", params.Tenant), - FieldSelector: fmt.Sprintf("metadata.name=%s%s", params.Tenant, params.PodName[len(params.Tenant):]), - } - if err = clientset.CoreV1().Pods(params.Namespace).DeleteCollection(ctx, metav1.DeleteOptions{}, listOpts); err != nil { - return restapi.ErrorWithContext(ctx, err) - } - return nil -} - -// GetTenantServiceURL gets tenant's service url with the proper scheme and port -func GetTenantServiceURL(mi *miniov2.Tenant) (svcURL string) { - scheme := "http" - port := miniov2.MinIOPortLoadBalancerSVC - if mi.AutoCert() || mi.ExternalCert() { - scheme = "https" - port = miniov2.MinIOTLSPortLoadBalancerSVC - } - return fmt.Sprintf("%s://%s", scheme, net.JoinHostPort(mi.MinIOFQDNServiceName(), strconv.Itoa(port))) -} - -func getTenantAdminClient(ctx context.Context, client K8sClientI, tenant *miniov2.Tenant, svcURL string) (*madmin.AdminClient, error) { - tenantCreds, err := getTenantCreds(ctx, client, tenant) - if err != nil { - return nil, err - } - sessionToken := "" - mAdmin, pErr := restapi.NewAdminClientWithInsecure(svcURL, tenantCreds.accessKey, tenantCreds.secretKey, sessionToken, true) - if pErr != nil { - return nil, pErr.Cause - } - return mAdmin, nil -} - -type tenantKeys struct { - accessKey string - secretKey string -} - -func getTenantCreds(ctx context.Context, client K8sClientI, tenant *miniov2.Tenant) (*tenantKeys, error) { - tenantConfiguration, err := GetTenantConfiguration(ctx, client, tenant) - if err != nil { - return nil, err - } - tenantAccessKey, ok := tenantConfiguration["accesskey"] - if !ok { - restapi.LogError("tenant's secret doesn't contain accesskey") - return nil, restapi.ErrDefault - } - tenantSecretKey, ok := tenantConfiguration["secretkey"] - if !ok { - restapi.LogError("tenant's secret doesn't contain secretkey") - return nil, restapi.ErrDefault - } - return &tenantKeys{accessKey: tenantAccessKey, secretKey: tenantSecretKey}, nil -} - -func getTenant(ctx context.Context, operatorClient OperatorClientI, namespace, tenantName string) (*miniov2.Tenant, error) { - tenant, err := operatorClient.TenantGet(ctx, namespace, tenantName, metav1.GetOptions{}) - if err != nil { - return nil, err - } - return tenant, nil -} - -func isPrometheusEnabled(annotations map[string]string) bool { - if annotations == nil { - return false - } - // if one of the following prometheus annotations are not present - // we consider the tenant as not integrated with prometheus - if _, ok := annotations[prometheusPath]; !ok { - return false - } - if _, ok := annotations[prometheusPort]; !ok { - return false - } - if _, ok := annotations[prometheusScrape]; !ok { - return false - } - return true -} - -func getTenantInfo(tenant *miniov2.Tenant) *models.Tenant { - var pools []*models.Pool - var totalSize int64 - for _, p := range tenant.Spec.Pools { - pools = append(pools, parseTenantPool(&p)) - poolSize := int64(p.Servers) * int64(p.VolumesPerServer) * p.VolumeClaimTemplate.Spec.Resources.Requests.Storage().Value() - totalSize += poolSize - } - var deletion string - if tenant.ObjectMeta.DeletionTimestamp != nil { - deletion = tenant.ObjectMeta.DeletionTimestamp.Format(time.RFC3339) - } - - return &models.Tenant{ - CreationDate: tenant.ObjectMeta.CreationTimestamp.Format(time.RFC3339), - DeletionDate: deletion, - Name: tenant.Name, - TotalSize: totalSize, - CurrentState: tenant.Status.CurrentState, - Pools: pools, - Namespace: tenant.ObjectMeta.Namespace, - Image: tenant.Spec.Image, - EnablePrometheus: isPrometheusEnabled(tenant.Annotations), - } -} - -func parseCertificate(name string, rawCert []byte) (*models.CertificateInfo, error) { - block, _ := pem.Decode(rawCert) - if block == nil { - return nil, errors.New("certificate failed to decode") - } - cert, err := x509.ParseCertificate(block.Bytes) - if err != nil { - return nil, err - } - domains := []string{} - // append certificate domain names - if len(cert.DNSNames) > 0 { - domains = append(domains, cert.DNSNames...) - } - // append certificate IPs - if len(cert.IPAddresses) > 0 { - for _, ip := range cert.IPAddresses { - domains = append(domains, ip.String()) - } - } - return &models.CertificateInfo{ - SerialNumber: cert.SerialNumber.String(), - Name: name, - Domains: domains, - Expiry: cert.NotAfter.Format(time.RFC3339), - }, nil -} - -var secretTypePublicKeyNameMap = map[string]string{ - "kubernetes.io/tls": "tls.crt", - "cert-manager.io/v1": "tls.crt", - "cert-manager.io/v1alpha2": "tls.crt", - // Add newer secretTypes and their corresponding values in future -} - -// parseTenantCertificates convert public key pem certificates stored in k8s secrets for a given Tenant into x509 certificates -func parseTenantCertificates(ctx context.Context, clientSet K8sClientI, namespace string, secrets []*miniov2.LocalCertificateReference) ([]*models.CertificateInfo, error) { - var certificates []*models.CertificateInfo - publicKey := "public.crt" - // Iterate over TLS secrets and build array of CertificateInfo structure - // that will be used to display information about certs in the UI - for _, secret := range secrets { - keyPair, err := clientSet.getSecret(ctx, namespace, secret.Name, metav1.GetOptions{}) - if err != nil { - return nil, err - } - if v, ok := secretTypePublicKeyNameMap[secret.Type]; ok { - publicKey = v - } - var rawCert []byte - if _, ok := keyPair.Data[publicKey]; !ok { - return nil, fmt.Errorf("public key: %v not found inside certificate secret %v", publicKey, secret.Name) - } - rawCert = keyPair.Data[publicKey] - var blocks []byte - for { - var block *pem.Block - block, rawCert = pem.Decode(rawCert) - if block == nil { - break - } - if block.Type == "CERTIFICATE" { - blocks = append(blocks, block.Bytes...) - } - } - // parse all certificates we found on this k8s secret - certs, err := x509.ParseCertificates(blocks) - if err != nil { - return nil, err - } - for _, cert := range certs { - var domains []string - if cert.Subject.CommonName != "" { - domains = append(domains, cert.Subject.CommonName) - } - // append certificate domain names - if len(cert.DNSNames) > 0 { - domains = append(domains, cert.DNSNames...) - } - // append certificate IPs - if len(cert.IPAddresses) > 0 { - for _, ip := range cert.IPAddresses { - domains = append(domains, ip.String()) - } - } - certificates = append(certificates, &models.CertificateInfo{ - SerialNumber: cert.SerialNumber.String(), - Name: secret.Name, - Domains: domains, - Expiry: cert.NotAfter.Format(time.RFC3339), - }) - } - } - return certificates, nil -} - -func getTenantSecurity(ctx context.Context, clientSet K8sClientI, tenant *miniov2.Tenant) (response *models.TenantSecurityResponse, err error) { - var minioExternalServerCertificates []*models.CertificateInfo - var minioExternalClientCertificates []*models.CertificateInfo - var minioExternalCaCertificates []*models.CertificateInfo - var tenantSecurityContext *models.SecurityContext - // Server certificates used by MinIO - if minioExternalServerCertificates, err = parseTenantCertificates(ctx, clientSet, tenant.Namespace, tenant.Spec.ExternalCertSecret); err != nil { - return nil, err - } - // Client certificates used by MinIO - if minioExternalClientCertificates, err = parseTenantCertificates(ctx, clientSet, tenant.Namespace, tenant.Spec.ExternalClientCertSecrets); err != nil { - return nil, err - } - // CA Certificates used by MinIO - if minioExternalCaCertificates, err = parseTenantCertificates(ctx, clientSet, tenant.Namespace, tenant.Spec.ExternalCaCertSecret); err != nil { - return nil, err - } - // Security Context used by MinIO server - if len(tenant.Spec.Pools) > 0 && tenant.Spec.Pools[0].SecurityContext != nil { - tenantSecurityContext = convertK8sSCToModelSC(tenant.Spec.Pools[0].SecurityContext) - } - return &models.TenantSecurityResponse{ - AutoCert: tenant.AutoCert(), - CustomCertificates: &models.TenantSecurityResponseCustomCertificates{ - Minio: minioExternalServerCertificates, - MinioCAs: minioExternalCaCertificates, - Client: minioExternalClientCertificates, - }, - SecurityContext: tenantSecurityContext, - }, nil -} - -func getTenantIdentityProvider(ctx context.Context, clientSet K8sClientI, tenant *miniov2.Tenant) (response *models.IdpConfiguration, err error) { - tenantConfiguration, err := GetTenantConfiguration(ctx, clientSet, tenant) - if err != nil { - return nil, err - } - - var idpConfiguration *models.IdpConfiguration - - if tenantConfiguration["MINIO_IDENTITY_OPENID_CONFIG_URL"] != "" { - - callbackURL := tenantConfiguration["MINIO_IDENTITY_OPENID_REDIRECT_URI"] - claimName := tenantConfiguration["MINIO_IDENTITY_OPENID_CLAIM_NAME"] - clientID := tenantConfiguration["MINIO_IDENTITY_OPENID_CLIENT_ID"] - configurationURL := tenantConfiguration["MINIO_IDENTITY_OPENID_CONFIG_URL"] - scopes := tenantConfiguration["MINIO_IDENTITY_OPENID_SCOPES"] - secretID := tenantConfiguration["MINIO_IDENTITY_OPENID_CLIENT_SECRET"] - - idpConfiguration = &models.IdpConfiguration{ - Oidc: &models.IdpConfigurationOidc{ - CallbackURL: callbackURL, - ClaimName: &claimName, - ClientID: &clientID, - ConfigurationURL: &configurationURL, - Scopes: scopes, - SecretID: &secretID, - }, - } - } - if tenantConfiguration["MINIO_IDENTITY_LDAP_SERVER_ADDR"] != "" { - - groupSearchBaseDN := tenantConfiguration["MINIO_IDENTITY_LDAP_GROUP_SEARCH_BASE_DN"] - groupSearchFilter := tenantConfiguration["MINIO_IDENTITY_LDAP_GROUP_SEARCH_FILTER"] - lookupBindDN := tenantConfiguration["MINIO_IDENTITY_LDAP_LOOKUP_BIND_DN"] - lookupBindPassword := tenantConfiguration["MINIO_IDENTITY_LDAP_LOOKUP_BIND_PASSWORD"] - serverInsecure := tenantConfiguration["MINIO_IDENTITY_LDAP_SERVER_INSECURE"] == "on" - serverStartTLS := tenantConfiguration["MINIO_IDENTITY_LDAP_SERVER_STARTTLS"] == "on" - tlsSkipVerify := tenantConfiguration["MINIO_IDENTITY_LDAP_TLS_SKIP_VERIFY"] == "on" - serverAddress := tenantConfiguration["MINIO_IDENTITY_LDAP_SERVER_ADDR"] - userDNSearchBaseDN := tenantConfiguration["MINIO_IDENTITY_LDAP_USER_DN_SEARCH_BASE_DN"] - userDNSearchFilter := tenantConfiguration["MINIO_IDENTITY_LDAP_USER_DN_SEARCH_FILTER"] - - idpConfiguration = &models.IdpConfiguration{ - ActiveDirectory: &models.IdpConfigurationActiveDirectory{ - GroupSearchBaseDn: groupSearchBaseDN, - GroupSearchFilter: groupSearchFilter, - LookupBindDn: &lookupBindDN, - LookupBindPassword: lookupBindPassword, - ServerInsecure: serverInsecure, - ServerStartTLS: serverStartTLS, - SkipTLSVerification: tlsSkipVerify, - URL: &serverAddress, - UserDnSearchBaseDn: userDNSearchBaseDN, - UserDnSearchFilter: userDNSearchFilter, - }, - } - } - return idpConfiguration, nil -} - -func updateTenantIdentityProvider(ctx context.Context, operatorClient OperatorClientI, client K8sClientI, namespace string, params operator_api.UpdateTenantIdentityProviderParams) error { - tenant, err := operatorClient.TenantGet(ctx, namespace, params.Tenant, metav1.GetOptions{}) - if err != nil { - return err - } - tenantConfiguration, err := GetTenantConfiguration(ctx, client, tenant) - if err != nil { - return err - } - - delete(tenantConfiguration, "accesskey") - delete(tenantConfiguration, "secretkey") - - oidcConfig := params.Body.Oidc - // set new oidc configuration fields - if oidcConfig != nil { - configurationURL := *oidcConfig.ConfigurationURL - clientID := *oidcConfig.ClientID - secretID := *oidcConfig.SecretID - claimName := *oidcConfig.ClaimName - scopes := oidcConfig.Scopes - callbackURL := oidcConfig.CallbackURL - // oidc config - tenantConfiguration["MINIO_IDENTITY_OPENID_CONFIG_URL"] = configurationURL - tenantConfiguration["MINIO_IDENTITY_OPENID_CLIENT_ID"] = clientID - tenantConfiguration["MINIO_IDENTITY_OPENID_CLIENT_SECRET"] = secretID - tenantConfiguration["MINIO_IDENTITY_OPENID_CLAIM_NAME"] = claimName - tenantConfiguration["MINIO_IDENTITY_OPENID_REDIRECT_URI"] = callbackURL - if scopes == "" { - scopes = "openid,profile,email" - } - tenantConfiguration["MINIO_IDENTITY_OPENID_SCOPES"] = scopes - } else { - // reset oidc configuration fields - delete(tenantConfiguration, "MINIO_IDENTITY_OPENID_CLAIM_NAME") - delete(tenantConfiguration, "MINIO_IDENTITY_OPENID_CLIENT_ID") - delete(tenantConfiguration, "MINIO_IDENTITY_OPENID_CONFIG_URL") - delete(tenantConfiguration, "MINIO_IDENTITY_OPENID_SCOPES") - delete(tenantConfiguration, "MINIO_IDENTITY_OPENID_CLIENT_SECRET") - delete(tenantConfiguration, "MINIO_IDENTITY_OPENID_REDIRECT_URI") - } - ldapConfig := params.Body.ActiveDirectory - // set new active directory configuration fields - if ldapConfig != nil { - // ldap config - serverAddress := *ldapConfig.URL - tlsSkipVerify := ldapConfig.SkipTLSVerification - serverInsecure := ldapConfig.ServerInsecure - lookupBindDN := *ldapConfig.LookupBindDn - lookupBindPassword := ldapConfig.LookupBindPassword - userDNSearchBaseDN := ldapConfig.UserDnSearchBaseDn - userDNSearchFilter := ldapConfig.UserDnSearchFilter - groupSearchBaseDN := ldapConfig.GroupSearchBaseDn - groupSearchFilter := ldapConfig.GroupSearchFilter - serverStartTLS := ldapConfig.ServerStartTLS - // LDAP Server - tenantConfiguration["MINIO_IDENTITY_LDAP_SERVER_ADDR"] = serverAddress - if tlsSkipVerify { - tenantConfiguration["MINIO_IDENTITY_LDAP_TLS_SKIP_VERIFY"] = "on" - } - if serverInsecure { - tenantConfiguration["MINIO_IDENTITY_LDAP_SERVER_INSECURE"] = "on" - } - if serverStartTLS { - tenantConfiguration["MINIO_IDENTITY_LDAP_SERVER_STARTTLS"] = "on" - } - // LDAP Lookup - tenantConfiguration["MINIO_IDENTITY_LDAP_LOOKUP_BIND_DN"] = lookupBindDN - tenantConfiguration["MINIO_IDENTITY_LDAP_LOOKUP_BIND_PASSWORD"] = lookupBindPassword - // LDAP User DN - tenantConfiguration["MINIO_IDENTITY_LDAP_USER_DN_SEARCH_BASE_DN"] = userDNSearchBaseDN - tenantConfiguration["MINIO_IDENTITY_LDAP_USER_DN_SEARCH_FILTER"] = userDNSearchFilter - // LDAP Group - tenantConfiguration["MINIO_IDENTITY_LDAP_GROUP_SEARCH_BASE_DN"] = groupSearchBaseDN - tenantConfiguration["MINIO_IDENTITY_LDAP_GROUP_SEARCH_FILTER"] = groupSearchFilter - } else { - // reset active directory configuration fields - delete(tenantConfiguration, "MINIO_IDENTITY_LDAP_GROUP_SEARCH_BASE_DN") - delete(tenantConfiguration, "MINIO_IDENTITY_LDAP_GROUP_SEARCH_FILTER") - delete(tenantConfiguration, "MINIO_IDENTITY_LDAP_LOOKUP_BIND_DN") - delete(tenantConfiguration, "MINIO_IDENTITY_LDAP_LOOKUP_BIND_PASSWORD") - delete(tenantConfiguration, "MINIO_IDENTITY_LDAP_SERVER_INSECURE") - delete(tenantConfiguration, "MINIO_IDENTITY_LDAP_SERVER_STARTTLS") - delete(tenantConfiguration, "MINIO_IDENTITY_LDAP_TLS_SKIP_VERIFY") - delete(tenantConfiguration, "MINIO_IDENTITY_LDAP_SERVER_ADDR") - delete(tenantConfiguration, "MINIO_IDENTITY_LDAP_USER_DN_SEARCH_BASE_DN") - delete(tenantConfiguration, "MINIO_IDENTITY_LDAP_USER_DN_SEARCH_FILTER") - } - // write tenant configuration to secret that contains config.env - tenantConfigurationName := fmt.Sprintf("%s-env-configuration", tenant.Name) - _, err = createOrReplaceSecrets(ctx, client, tenant.Namespace, []tenantSecret{ - { - Name: tenantConfigurationName, - Content: map[string][]byte{ - "config.env": []byte(GenerateTenantConfigurationFile(tenantConfiguration)), - }, - }, - }, tenant.Name) - if err != nil { - return err - } - tenant.Spec.Configuration = &corev1.LocalObjectReference{Name: tenantConfigurationName} - tenant.EnsureDefaults() - // update tenant CRD - _, err = operatorClient.TenantUpdate(ctx, tenant, metav1.UpdateOptions{}) - return err -} - -func getTenantIdentityProviderResponse(session *models.Principal, params operator_api.TenantIdentityProviderParams) (*models.IdpConfiguration, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - opClient := &operatorClient{ - client: opClientClientSet, - } - // get Kubernetes Client - clientSet, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - k8sClient := k8sClient{ - client: clientSet, - } - minTenant, err := getTenant(ctx, opClient, params.Namespace, params.Tenant) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - info, err := getTenantIdentityProvider(ctx, &k8sClient, minTenant) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - return info, nil -} - -func getUpdateTenantIdentityProviderResponse(session *models.Principal, params operator_api.UpdateTenantIdentityProviderParams) *models.Error { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - // get Kubernetes Client - clientSet, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - k8sClient := k8sClient{ - client: clientSet, - } - opClient := &operatorClient{ - client: opClientClientSet, - } - if err := updateTenantIdentityProvider(ctx, opClient, &k8sClient, params.Namespace, params); err != nil { - return restapi.ErrorWithContext(ctx, err, errors.New("unable to update tenant")) - } - return nil -} - -func getSetTenantAdministratorsResponse(session *models.Principal, params operator_api.SetTenantAdministratorsParams) *models.Error { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - // get Kubernetes Client - clientSet, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - k8sClient := &k8sClient{ - client: clientSet, - } - opClient := &operatorClient{ - client: opClientClientSet, - } - - minTenant, err := getTenant(ctx, opClient, params.Namespace, params.Tenant) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - return setTenantAdministrators(ctx, minTenant, k8sClient, params) -} - -func setTenantAdministrators(ctx context.Context, minTenant *miniov2.Tenant, k8sClient K8sClientI, params operator_api.SetTenantAdministratorsParams) *models.Error { - minTenant.EnsureDefaults() - - svcURL := GetTenantServiceURL(minTenant) - // getTenantAdminClient will use all certificates under ~/.console/certs/CAs to trust the TLS connections with MinIO tenants - mAdmin, err := getTenantAdminClient( - ctx, - k8sClient, - minTenant, - svcURL, - ) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - // create a minioClient interface implementation - // defining the client to be used - adminClient := restapi.AdminClient{Client: mAdmin} - for _, user := range params.Body.UserDNS { - if err := restapi.SetPolicy(ctx, adminClient, "consoleAdmin", user, "user"); err != nil { - return restapi.ErrorWithContext(ctx, err) - } - } - for _, group := range params.Body.GroupDNS { - if err := restapi.SetPolicy(ctx, adminClient, "consoleAdmin", group, "group"); err != nil { - return restapi.ErrorWithContext(ctx, err) - } - } - return nil -} - -func getTenantConfigurationResponse(session *models.Principal, params operator_api.TenantConfigurationParams) (*models.TenantConfigurationResponse, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - opClient := &operatorClient{ - client: opClientClientSet, - } - // get Kubernetes Client - clientSet, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - k8sClient := &k8sClient{ - client: clientSet, - } - minTenant, err := getTenant(ctx, opClient, params.Namespace, params.Tenant) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - return parseTenantConfiguration(ctx, k8sClient, minTenant) -} - -func parseTenantConfiguration(ctx context.Context, k8sClient K8sClientI, minTenant *miniov2.Tenant) (*models.TenantConfigurationResponse, *models.Error) { - tenantConfiguration, err := GetTenantConfiguration(ctx, k8sClient, minTenant) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - delete(tenantConfiguration, "accesskey") - delete(tenantConfiguration, "secretkey") - var envVars []*models.EnvironmentVariable - for key, value := range tenantConfiguration { - envVars = append(envVars, &models.EnvironmentVariable{ - Key: key, - Value: value, - }) - } - sort.Slice(envVars, func(i, j int) bool { - return envVars[i].Key < envVars[j].Key - }) - configurationInfo := &models.TenantConfigurationResponse{EnvironmentVariables: envVars} - return configurationInfo, nil -} - -func getUpdateTenantConfigurationResponse(session *models.Principal, params operator_api.UpdateTenantConfigurationParams) *models.Error { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - // get Kubernetes Client - clientSet, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - k8sClient := k8sClient{ - client: clientSet, - } - opClient := &operatorClient{ - client: opClientClientSet, - } - if err := updateTenantConfigurationFile(ctx, opClient, &k8sClient, params.Namespace, params); err != nil { - return restapi.ErrorWithContext(ctx, err, errors.New("unable to update tenant configuration")) - } - return nil -} - -func updateTenantConfigurationFile(ctx context.Context, operatorClient OperatorClientI, client K8sClientI, namespace string, params operator_api.UpdateTenantConfigurationParams) error { - tenant, err := operatorClient.TenantGet(ctx, namespace, params.Tenant, metav1.GetOptions{}) - if err != nil { - return err - } - tenantConfiguration, err := GetTenantConfiguration(ctx, client, tenant) - if err != nil { - return err - } - - delete(tenantConfiguration, "accesskey") - delete(tenantConfiguration, "secretkey") - - requestBody := params.Body - if requestBody == nil { - return errors.New("missing request body") - } - // Patch tenant configuration file with the new values provided by the user - for _, envVar := range requestBody.EnvironmentVariables { - if envVar.Key == "" { - continue - } - tenantConfiguration[envVar.Key] = envVar.Value - } - // Remove existing values from configuration file - for _, keyToBeDeleted := range requestBody.KeysToBeDeleted { - delete(tenantConfiguration, keyToBeDeleted) - } - - if !tenant.HasConfigurationSecret() { - return errors.New("tenant configuration file not found") - } - tenantConfigurationSecret, err := client.getSecret(ctx, tenant.Namespace, tenant.Spec.Configuration.Name, metav1.GetOptions{}) - if err != nil { - return err - } - tenantConfigurationSecret.Data["config.env"] = []byte(GenerateTenantConfigurationFile(tenantConfiguration)) - _, err = client.updateSecret(ctx, namespace, tenantConfigurationSecret, metav1.UpdateOptions{}) - if err != nil { - return err - } - // Restart all MinIO pods at the same time for they to take the new configuration - err = client.deletePodCollection(ctx, namespace, metav1.DeleteOptions{}, metav1.ListOptions{ - LabelSelector: fmt.Sprintf("%s=%s", miniov2.TenantLabel, tenant.Name), - }) - if err != nil { - return err - } - return nil -} - -func getTenantSecurityResponse(session *models.Principal, params operator_api.TenantSecurityParams) (*models.TenantSecurityResponse, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - opClient := &operatorClient{ - client: opClientClientSet, - } - // get Kubernetes Client - clientSet, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - k8sClient := k8sClient{ - client: clientSet, - } - minTenant, err := getTenant(ctx, opClient, params.Namespace, params.Tenant) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - info, err := getTenantSecurity(ctx, &k8sClient, minTenant) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - return info, nil -} - -func getUpdateTenantSecurityResponse(session *models.Principal, params operator_api.UpdateTenantSecurityParams) *models.Error { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - // get Kubernetes Client - clientSet, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - k8sClient := k8sClient{ - client: clientSet, - } - opClient := &operatorClient{ - client: opClientClientSet, - } - if err := updateTenantSecurity(ctx, opClient, &k8sClient, params.Namespace, params); err != nil { - return restapi.ErrorWithContext(ctx, err, errors.New("unable to update tenant")) - } - return nil -} - -// updateTenantSecurity -func updateTenantSecurity(ctx context.Context, operatorClient OperatorClientI, client K8sClientI, namespace string, params operator_api.UpdateTenantSecurityParams) error { - minInst, err := operatorClient.TenantGet(ctx, namespace, params.Tenant, metav1.GetOptions{}) - if err != nil { - return err - } - // Update AutoCert - minInst.Spec.RequestAutoCert = ¶ms.Body.AutoCert - var newExternalCertSecret []*miniov2.LocalCertificateReference - var newExternalClientCertSecrets []*miniov2.LocalCertificateReference - var newExternalCaCertSecret []*miniov2.LocalCertificateReference - secretsToBeRemoved := map[string]bool{} - - if params.Body.CustomCertificates != nil { - // Copy certificate secrets to be deleted into map - for _, secret := range params.Body.CustomCertificates.SecretsToBeDeleted { - secretsToBeRemoved[secret] = true - } - - // Remove certificates from Tenant.Spec.ExternalCertSecret - for _, certificate := range minInst.Spec.ExternalCertSecret { - if _, ok := secretsToBeRemoved[certificate.Name]; !ok { - newExternalCertSecret = append(newExternalCertSecret, certificate) - } - } - // Remove certificates from Tenant.Spec.ExternalClientCertSecrets - for _, certificate := range minInst.Spec.ExternalClientCertSecrets { - if _, ok := secretsToBeRemoved[certificate.Name]; !ok { - newExternalClientCertSecrets = append(newExternalClientCertSecrets, certificate) - } - } - // Remove certificates from Tenant.Spec.ExternalCaCertSecret - for _, certificate := range minInst.Spec.ExternalCaCertSecret { - if _, ok := secretsToBeRemoved[certificate.Name]; !ok { - newExternalCaCertSecret = append(newExternalCaCertSecret, certificate) - } - } - - } - secretName := fmt.Sprintf("%s-%s", minInst.Name, strings.ToLower(utils.RandomCharString(5))) - // Create new Server Certificate Secrets for MinIO - externalServerCertSecretName := fmt.Sprintf("%s-external-server-certificate", secretName) - externalServerCertSecrets, err := createOrReplaceExternalCertSecrets(ctx, client, minInst.Namespace, params.Body.CustomCertificates.MinioServerCertificates, externalServerCertSecretName, minInst.Name) - if err != nil { - return err - } - newExternalCertSecret = append(newExternalCertSecret, externalServerCertSecrets...) - // Create new Client Certificate Secrets for MinIO - externalClientCertSecretName := fmt.Sprintf("%s-external-client-certificate", secretName) - externalClientCertSecrets, err := createOrReplaceExternalCertSecrets(ctx, client, minInst.Namespace, params.Body.CustomCertificates.MinioClientCertificates, externalClientCertSecretName, minInst.Name) - if err != nil { - return err - } - newExternalClientCertSecrets = append(newExternalClientCertSecrets, externalClientCertSecrets...) - // Create new CAs Certificate Secrets for MinIO - var caCertificates []tenantSecret - for i, caCertificate := range params.Body.CustomCertificates.MinioCAsCertificates { - certificateContent, err := base64.StdEncoding.DecodeString(caCertificate) - if err != nil { - return err - } - caCertificates = append(caCertificates, tenantSecret{ - Name: fmt.Sprintf("%s-ca-certificate-%d", secretName, i), - Content: map[string][]byte{ - "public.crt": certificateContent, - }, - }) - } - if len(caCertificates) > 0 { - certificateSecrets, err := createOrReplaceSecrets(ctx, client, minInst.Namespace, caCertificates, minInst.Name) - if err != nil { - return err - } - newExternalCaCertSecret = append(newExternalCaCertSecret, certificateSecrets...) - } - - // set Security Context - var newTenantSecurityContext *corev1.PodSecurityContext - newTenantSecurityContext, err = convertModelSCToK8sSC(params.Body.SecurityContext) - if err != nil { - return err - } - for index := range minInst.Spec.Pools { - minInst.Spec.Pools[index].SecurityContext = newTenantSecurityContext - } - - // Update External Certificates - minInst.Spec.ExternalCertSecret = newExternalCertSecret - minInst.Spec.ExternalClientCertSecrets = newExternalClientCertSecrets - minInst.Spec.ExternalCaCertSecret = newExternalCaCertSecret - _, err = operatorClient.TenantUpdate(ctx, minInst, metav1.UpdateOptions{}) - return err -} - -func listTenants(ctx context.Context, operatorClient OperatorClientI, namespace string, limit *int32) (*models.ListTenantsResponse, error) { - listOpts := metav1.ListOptions{ - Limit: 10, - } - - if limit != nil { - listOpts.Limit = int64(*limit) - } - - minTenants, err := operatorClient.TenantList(ctx, namespace, listOpts) - if err != nil { - return nil, err - } - - var tenants []*models.TenantList - - for _, tenant := range minTenants.Items { - var totalSize int64 - var instanceCount int64 - var volumeCount int64 - for _, pool := range tenant.Spec.Pools { - instanceCount += int64(pool.Servers) - volumeCount += int64(pool.Servers * pool.VolumesPerServer) - if pool.VolumeClaimTemplate != nil { - poolSize := int64(pool.VolumesPerServer) * int64(pool.Servers) * pool.VolumeClaimTemplate.Spec.Resources.Requests.Storage().Value() - totalSize += poolSize - } - } - - var deletion string - if tenant.ObjectMeta.DeletionTimestamp != nil { - deletion = tenant.ObjectMeta.DeletionTimestamp.Format(time.RFC3339) - } - - var tiers []*models.TenantTierElement - - for _, tier := range tenant.Status.Usage.Tiers { - tierItem := &models.TenantTierElement{ - Name: tier.Name, - Type: tier.Type, - Size: tier.TotalSize, - } - - tiers = append(tiers, tierItem) - } - - var domains models.DomainsConfiguration - - if tenant.Spec.Features != nil && tenant.Spec.Features.Domains != nil { - domains = models.DomainsConfiguration{ - Console: tenant.Spec.Features.Domains.Console, - Minio: tenant.Spec.Features.Domains.Minio, - } - } - - tenants = append(tenants, &models.TenantList{ - CreationDate: tenant.ObjectMeta.CreationTimestamp.Format(time.RFC3339), - DeletionDate: deletion, - Name: tenant.ObjectMeta.Name, - PoolCount: int64(len(tenant.Spec.Pools)), - InstanceCount: instanceCount, - VolumeCount: volumeCount, - CurrentState: tenant.Status.CurrentState, - Namespace: tenant.ObjectMeta.Namespace, - TotalSize: totalSize, - HealthStatus: string(tenant.Status.HealthStatus), - CapacityRaw: tenant.Status.Usage.RawCapacity, - CapacityRawUsage: tenant.Status.Usage.RawUsage, - Capacity: tenant.Status.Usage.Capacity, - CapacityUsage: tenant.Status.Usage.Usage, - Tiers: tiers, - Domains: &domains, - }) - } - - return &models.ListTenantsResponse{ - Tenants: tenants, - Total: int64(len(tenants)), - }, nil -} - -func getListAllTenantsResponse(session *models.Principal, params operator_api.ListAllTenantsParams) (*models.ListTenantsResponse, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - opClient := &operatorClient{ - client: opClientClientSet, - } - listT, err := listTenants(ctx, opClient, "", params.Limit) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - return listT, nil -} - -// getListTenantsResponse list tenants by namespace -func getListTenantsResponse(session *models.Principal, params operator_api.ListTenantsParams) (*models.ListTenantsResponse, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - opClient := &operatorClient{ - client: opClientClientSet, - } - listT, err := listTenants(ctx, opClient, params.Namespace, params.Limit) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - return listT, nil -} - -// setImageRegistry creates a secret to store the private registry credentials, if one exist it updates the existing one -// returns the name of the secret created/updated -func setImageRegistry(ctx context.Context, req *models.ImageRegistry, clientset K8sClientI, namespace, tenantName string) (string, error) { - if req == nil || req.Registry == nil || req.Username == nil || req.Password == nil { - return "", nil - } - - credentials := make(map[string]imageRegistryCredentials) - // username:password encoded - authData := []byte(fmt.Sprintf("%s:%s", *req.Username, *req.Password)) - authStr := base64.StdEncoding.EncodeToString(authData) - - credentials[*req.Registry] = imageRegistryCredentials{ - Username: *req.Username, - Password: *req.Password, - Auth: authStr, - } - imRegistry := imageRegistry{ - Auths: credentials, - } - imRegistryJSON, err := json.Marshal(imRegistry) - if err != nil { - return "", err - } - - pullSecretName := fmt.Sprintf("%s-regcred", tenantName) - secretCredentials := map[string][]byte{ - corev1.DockerConfigJsonKey: []byte(string(imRegistryJSON)), - } - // Get or Create secret if it doesn't exist - currentSecret, err := clientset.getSecret(ctx, namespace, pullSecretName, metav1.GetOptions{}) - if err != nil { - if k8sErrors.IsNotFound(err) { - instanceSecret := corev1.Secret{ - ObjectMeta: metav1.ObjectMeta{ - Name: pullSecretName, - Labels: map[string]string{ - miniov2.TenantLabel: tenantName, - }, - }, - Data: secretCredentials, - Type: corev1.SecretTypeDockerConfigJson, - } - _, err = clientset.createSecret(ctx, namespace, &instanceSecret, metav1.CreateOptions{}) - if err != nil { - return "", err - } - return pullSecretName, nil - } - return "", err - } - currentSecret.Data = secretCredentials - _, err = clientset.updateSecret(ctx, namespace, currentSecret, metav1.UpdateOptions{}) - if err != nil { - return "", err - } - return pullSecretName, nil -} - -// addAnnotations will merge two annotation maps -func addAnnotations(annotationsOne, annotationsTwo map[string]string) map[string]string { - if annotationsOne == nil { - annotationsOne = map[string]string{} - } - for key, value := range annotationsTwo { - annotationsOne[key] = value - } - return annotationsOne -} - -// removeAnnotations will remove keys from the first annotations map based on the second one -func removeAnnotations(annotationsOne, annotationsTwo map[string]string) map[string]string { - if annotationsOne == nil { - annotationsOne = map[string]string{} - } - for key := range annotationsTwo { - delete(annotationsOne, key) - } - return annotationsOne -} - -func getUpdateTenantResponse(session *models.Principal, params operator_api.UpdateTenantParams) *models.Error { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - // get Kubernetes Client - clientSet, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - k8sClient := &k8sClient{ - client: clientSet, - } - opClient := &operatorClient{ - client: opClientClientSet, - } - client := restapi.GetConsoleHTTPClient("") - client.Timeout = 4 * time.Second - httpC := &utils2.Client{ - Client: client, - } - if err := updateTenantAction(ctx, opClient, k8sClient, httpC, params.Namespace, params); err != nil { - return restapi.ErrorWithContext(ctx, err, errors.New("unable to update tenant")) - } - return nil -} - -// addTenantPool creates a pool to a defined tenant -func addTenantPool(ctx context.Context, operatorClient OperatorClientI, params operator_api.TenantAddPoolParams) error { - tenant, err := operatorClient.TenantGet(ctx, params.Namespace, params.Tenant, metav1.GetOptions{}) - if err != nil { - return err - } - - poolParams := params.Body - pool, err := parseTenantPoolRequest(poolParams) - if err != nil { - return err - } - tenant.Spec.Pools = append(tenant.Spec.Pools, *pool) - payloadBytes, err := json.Marshal(tenant) - if err != nil { - return err - } - - _, err = operatorClient.TenantPatch(ctx, tenant.Namespace, tenant.Name, types.MergePatchType, payloadBytes, metav1.PatchOptions{}) - if err != nil { - return err - } - return nil -} - -func getTenantAddPoolResponse(session *models.Principal, params operator_api.TenantAddPoolParams) *models.Error { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - opClient := &operatorClient{ - client: opClientClientSet, - } - if err := addTenantPool(ctx, opClient, params); err != nil { - return restapi.ErrorWithContext(ctx, err, errors.New("unable to add pool")) - } - return nil -} - -// getTenantUsageResponse returns the usage of a tenant -func getTenantUsageResponse(session *models.Principal, params operator_api.GetTenantUsageParams) (*models.TenantUsage, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err, restapi.ErrUnableToGetTenantUsage) - } - clientSet, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err, restapi.ErrUnableToGetTenantUsage) - } - - opClient := &operatorClient{ - client: opClientClientSet, - } - k8sClient := &k8sClient{ - client: clientSet, - } - - minTenant, err := getTenant(ctx, opClient, params.Namespace, params.Tenant) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err, restapi.ErrUnableToGetTenantUsage) - } - return getTenantUsage(ctx, minTenant, k8sClient) -} - -func getTenantUsage(ctx context.Context, minTenant *miniov2.Tenant, k8sClient K8sClientI) (*models.TenantUsage, *models.Error) { - minTenant.EnsureDefaults() - - svcURL := GetTenantServiceURL(minTenant) - // getTenantAdminClient will use all certificates under ~/.console/certs/CAs to trust the TLS connections with MinIO tenants - mAdmin, err := getTenantAdminClient( - ctx, - k8sClient, - minTenant, - svcURL, - ) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err, restapi.ErrUnableToGetTenantUsage) - } - return _getTenantUsage(ctx, restapi.AdminClient{Client: mAdmin}) -} - -func _getTenantUsage(ctx context.Context, adminClient restapi.MinioAdmin) (*models.TenantUsage, *models.Error) { - adminInfo, err := restapi.GetAdminInfo(ctx, adminClient) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err, restapi.ErrUnableToGetTenantUsage) - } - return &models.TenantUsage{Used: adminInfo.Usage, DiskUsed: adminInfo.DisksUsage}, nil -} - -func getTenantPodsResponse(session *models.Principal, params operator_api.GetTenantPodsParams) ([]*models.TenantPod, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - clientset, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - listOpts := metav1.ListOptions{ - LabelSelector: fmt.Sprintf("%s=%s", miniov2.TenantLabel, params.Tenant), - } - pods, err := clientset.CoreV1().Pods(params.Namespace).List(ctx, listOpts) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - return getTenantPods(pods), nil -} - -func getTenantPods(pods *corev1.PodList) []*models.TenantPod { - retval := []*models.TenantPod{} - for _, pod := range pods.Items { - var restarts int64 - if len(pod.Status.ContainerStatuses) > 0 { - restarts = int64(pod.Status.ContainerStatuses[0].RestartCount) - } - status := string(pod.Status.Phase) - if pod.DeletionTimestamp != nil { - status = "Terminating" - } - retval = append(retval, &models.TenantPod{ - Name: swag.String(pod.Name), - Status: status, - TimeCreated: pod.CreationTimestamp.Unix(), - PodIP: pod.Status.PodIP, - Restarts: restarts, - Node: pod.Spec.NodeName, - }) - } - return retval -} - -func getPodLogsResponse(session *models.Principal, params operator_api.GetPodLogsParams) (string, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - clientset, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return "", restapi.ErrorWithContext(ctx, err) - } - listOpts := &corev1.PodLogOptions{} - logs := clientset.CoreV1().Pods(params.Namespace).GetLogs(params.PodName, listOpts) - buff, err := logs.DoRaw(ctx) - if err != nil { - return "", restapi.ErrorWithContext(ctx, err) - } - return string(buff), nil -} - -func getPodEventsResponse(session *models.Principal, params operator_api.GetPodEventsParams) (models.EventListWrapper, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - clientset, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - pod, err := clientset.CoreV1().Pods(params.Namespace).Get(ctx, params.PodName, metav1.GetOptions{}) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - events, err := clientset.CoreV1().Events(params.Namespace).List(ctx, metav1.ListOptions{FieldSelector: fmt.Sprintf("involvedObject.uid=%s", pod.UID)}) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - retval := models.EventListWrapper{} - for i := 0; i < len(events.Items); i++ { - retval = append(retval, &models.EventListElement{ - Namespace: events.Items[i].Namespace, - LastSeen: events.Items[i].LastTimestamp.Unix(), - Message: events.Items[i].Message, - EventType: events.Items[i].Type, - Reason: events.Items[i].Reason, - }) - } - sort.SliceStable(retval, func(i int, j int) bool { - return retval[i].LastSeen < retval[j].LastSeen - }) - return retval, nil -} - -func getDescribePodResponse(session *models.Principal, params operator_api.DescribePodParams) (*models.DescribePodWrapper, *models.Error) { - ctx := context.Background() - clientset, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - pod, err := clientset.CoreV1().Pods(params.Namespace).Get(ctx, params.PodName, metav1.GetOptions{}) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - retval := &models.DescribePodWrapper{ - Name: pod.Name, - Namespace: pod.Namespace, - PriorityClassName: pod.Spec.PriorityClassName, - NodeName: pod.Spec.NodeName, - } - if pod.Spec.Priority != nil { - retval.Priority = int64(*pod.Spec.Priority) - } - if pod.Status.StartTime != nil { - retval.StartTime = pod.Status.StartTime.Time.String() - } - labelArray := make([]*models.Label, len(pod.Labels)) - i := 0 - for key := range pod.Labels { - labelArray[i] = &models.Label{Key: key, Value: pod.Labels[key]} - i++ - } - retval.Labels = labelArray - annotationArray := make([]*models.Annotation, len(pod.Annotations)) - i = 0 - for key := range pod.Annotations { - annotationArray[i] = &models.Annotation{Key: key, Value: pod.Annotations[key]} - i++ - } - retval.Annotations = annotationArray - if pod.DeletionTimestamp != nil { - retval.DeletionTimestamp = translateTimestampSince(*pod.DeletionTimestamp) - retval.DeletionGracePeriodSeconds = *pod.DeletionGracePeriodSeconds - } - retval.Phase = string(pod.Status.Phase) - retval.Reason = pod.Status.Reason - retval.Message = pod.Status.Message - retval.PodIP = pod.Status.PodIP - retval.ControllerRef = metav1.GetControllerOf(pod).String() - retval.Containers = make([]*models.Container, len(pod.Spec.Containers)) - statusMap := map[string]corev1.ContainerStatus{} - statusKeys := make([]string, len(pod.Status.ContainerStatuses)) - for i, status := range pod.Status.ContainerStatuses { - statusMap[status.Name] = status - statusKeys[i] = status.Name - - } - for i := range pod.Spec.Containers { - retval.Containers[i] = &models.Container{ - Name: pod.Spec.Containers[i].Name, - Image: pod.Spec.Containers[i].Image, - Ports: describeContainerPorts(pod.Spec.Containers[i].Ports), - HostPorts: describeContainerHostPorts(pod.Spec.Containers[i].Ports), - Args: pod.Spec.Containers[i].Args, - } - if slices.Contains(statusKeys, pod.Spec.Containers[i].Name) { - retval.Containers[i].ContainerID = statusMap[pod.Spec.Containers[i].Name].ContainerID - retval.Containers[i].ImageID = statusMap[pod.Spec.Containers[i].Name].ImageID - retval.Containers[i].Ready = statusMap[pod.Spec.Containers[i].Name].Ready - retval.Containers[i].RestartCount = int64(statusMap[pod.Spec.Containers[i].Name].RestartCount) - retval.Containers[i].State, retval.Containers[i].LastState = describeStatus(statusMap[pod.Spec.Containers[i].Name]) - } - retval.Containers[i].EnvironmentVariables = make([]*models.EnvironmentVariable, len(pod.Spec.Containers[0].Env)) - for j := range pod.Spec.Containers[i].Env { - retval.Containers[i].EnvironmentVariables[j] = &models.EnvironmentVariable{ - Key: pod.Spec.Containers[i].Env[j].Name, - Value: pod.Spec.Containers[i].Env[j].Value, - } - } - retval.Containers[i].Mounts = make([]*models.Mount, len(pod.Spec.Containers[i].VolumeMounts)) - for j := range pod.Spec.Containers[i].VolumeMounts { - retval.Containers[i].Mounts[j] = &models.Mount{ - Name: pod.Spec.Containers[i].VolumeMounts[j].Name, - MountPath: pod.Spec.Containers[i].VolumeMounts[j].MountPath, - SubPath: pod.Spec.Containers[i].VolumeMounts[j].SubPath, - ReadOnly: pod.Spec.Containers[i].VolumeMounts[j].ReadOnly, - } - } - } - retval.Conditions = make([]*models.Condition, len(pod.Status.Conditions)) - for i := range pod.Status.Conditions { - retval.Conditions[i] = &models.Condition{ - Type: string(pod.Status.Conditions[i].Type), - Status: string(pod.Status.Conditions[i].Status), - } - } - retval.Volumes = make([]*models.Volume, len(pod.Spec.Volumes)) - for i := range pod.Spec.Volumes { - retval.Volumes[i] = &models.Volume{ - Name: pod.Spec.Volumes[i].Name, - } - if pod.Spec.Volumes[i].PersistentVolumeClaim != nil { - retval.Volumes[i].Pvc = &models.Pvc{ - ReadOnly: pod.Spec.Volumes[i].PersistentVolumeClaim.ReadOnly, - ClaimName: pod.Spec.Volumes[i].PersistentVolumeClaim.ClaimName, - } - } else if pod.Spec.Volumes[i].Projected != nil { - retval.Volumes[i].Projected = &models.ProjectedVolume{} - retval.Volumes[i].Projected.Sources = make([]*models.ProjectedVolumeSource, len(pod.Spec.Volumes[i].Projected.Sources)) - for j := range pod.Spec.Volumes[i].Projected.Sources { - retval.Volumes[i].Projected.Sources[j] = &models.ProjectedVolumeSource{} - if pod.Spec.Volumes[i].Projected.Sources[j].Secret != nil { - retval.Volumes[i].Projected.Sources[j].Secret = &models.Secret{ - Name: pod.Spec.Volumes[i].Projected.Sources[j].Secret.Name, - Optional: pod.Spec.Volumes[i].Projected.Sources[j].Secret.Optional != nil, - } - } - if pod.Spec.Volumes[i].Projected.Sources[j].DownwardAPI != nil { - retval.Volumes[i].Projected.Sources[j].DownwardAPI = true - } - if pod.Spec.Volumes[i].Projected.Sources[j].ConfigMap != nil { - retval.Volumes[i].Projected.Sources[j].ConfigMap = &models.ConfigMap{ - Name: pod.Spec.Volumes[i].Projected.Sources[j].ConfigMap.Name, - Optional: pod.Spec.Volumes[i].Projected.Sources[j].ConfigMap.Optional != nil, - } - } - if pod.Spec.Volumes[i].Projected.Sources[j].ServiceAccountToken != nil { - retval.Volumes[i].Projected.Sources[j].ServiceAccountToken = &models.ServiceAccountToken{ExpirationSeconds: *pod.Spec.Volumes[i].Projected.Sources[j].ServiceAccountToken.ExpirationSeconds} - } - } - } - } - retval.QosClass = string(getPodQOS(pod)) - nodeSelectorArray := make([]*models.NodeSelector, len(pod.Spec.NodeSelector)) - i = 0 - for key := range pod.Spec.NodeSelector { - nodeSelectorArray[i] = &models.NodeSelector{Key: key, Value: pod.Spec.NodeSelector[key]} - i++ - } - retval.NodeSelector = nodeSelectorArray - retval.Tolerations = make([]*models.Toleration, len(pod.Spec.Tolerations)) - for i := range pod.Spec.Tolerations { - retval.Tolerations[i] = &models.Toleration{ - Effect: string(pod.Spec.Tolerations[i].Effect), - Key: pod.Spec.Tolerations[i].Key, - Value: pod.Spec.Tolerations[i].Value, - Operator: string(pod.Spec.Tolerations[i].Operator), - TolerationSeconds: *pod.Spec.Tolerations[i].TolerationSeconds, - } - } - return retval, nil -} - -func describeStatus(status corev1.ContainerStatus) (*models.State, *models.State) { - retval := &models.State{} - last := &models.State{} - state := status.State - lastState := status.LastTerminationState - switch { - case state.Running != nil: - retval.State = "Running" - retval.Started = state.Running.StartedAt.Time.Format(time.RFC1123Z) - case state.Waiting != nil: - retval.State = "Waiting" - retval.Reason = state.Waiting.Reason - case state.Terminated != nil: - retval.State = "Terminated" - retval.Message = state.Terminated.Message - retval.ExitCode = int64(state.Terminated.ExitCode) - retval.Signal = int64(state.Terminated.Signal) - retval.Started = state.Terminated.StartedAt.Time.Format(time.RFC1123Z) - retval.Finished = state.Terminated.FinishedAt.Time.Format(time.RFC1123Z) - switch { - case lastState.Running != nil: - last.State = "Running" - last.Started = lastState.Running.StartedAt.Time.Format(time.RFC1123Z) - case lastState.Waiting != nil: - last.State = "Waiting" - last.Reason = lastState.Waiting.Reason - case lastState.Terminated != nil: - last.State = "Terminated" - last.Message = lastState.Terminated.Message - last.ExitCode = int64(lastState.Terminated.ExitCode) - last.Signal = int64(lastState.Terminated.Signal) - last.Started = lastState.Terminated.StartedAt.Time.Format(time.RFC1123Z) - last.Finished = lastState.Terminated.FinishedAt.Time.Format(time.RFC1123Z) - default: - last.State = "Waiting" - } - default: - retval.State = "Waiting" - } - return retval, last -} - -func describeContainerPorts(cPorts []corev1.ContainerPort) []string { - ports := make([]string, 0, len(cPorts)) - for _, cPort := range cPorts { - ports = append(ports, fmt.Sprintf("%d/%s", cPort.ContainerPort, cPort.Protocol)) - } - return ports -} - -func describeContainerHostPorts(cPorts []corev1.ContainerPort) []string { - ports := make([]string, 0, len(cPorts)) - for _, cPort := range cPorts { - ports = append(ports, fmt.Sprintf("%d/%s", cPort.HostPort, cPort.Protocol)) - } - return ports -} - -func getPodQOS(pod *corev1.Pod) corev1.PodQOSClass { - requests := corev1.ResourceList{} - limits := corev1.ResourceList{} - zeroQuantity := resource.MustParse("0") - isGuaranteed := true - allContainers := []corev1.Container{} - allContainers = append(allContainers, pod.Spec.Containers...) - allContainers = append(allContainers, pod.Spec.InitContainers...) - for _, container := range allContainers { - // process requests - for name, quantity := range container.Resources.Requests { - if !isSupportedQoSComputeResource(name) { - continue - } - if quantity.Cmp(zeroQuantity) == 1 { - delta := quantity.DeepCopy() - if _, exists := requests[name]; !exists { - requests[name] = delta - } else { - delta.Add(requests[name]) - requests[name] = delta - } - } - } - // process limits - qosLimitsFound := sets.NewString() - for name, quantity := range container.Resources.Limits { - if !isSupportedQoSComputeResource(name) { - continue - } - if quantity.Cmp(zeroQuantity) == 1 { - qosLimitsFound.Insert(string(name)) - delta := quantity.DeepCopy() - if _, exists := limits[name]; !exists { - limits[name] = delta - } else { - delta.Add(limits[name]) - limits[name] = delta - } - } - } - - if !qosLimitsFound.HasAll(string(corev1.ResourceMemory), string(corev1.ResourceCPU)) { - isGuaranteed = false - } - } - if len(requests) == 0 && len(limits) == 0 { - return corev1.PodQOSBestEffort - } - // Check is requests match limits for all resources. - if isGuaranteed { - for name, req := range requests { - if lim, exists := limits[name]; !exists || lim.Cmp(req) != 0 { - isGuaranteed = false - break - } - } - } - if isGuaranteed && - len(requests) == len(limits) { - return corev1.PodQOSGuaranteed - } - return corev1.PodQOSBurstable -} - -var supportedQoSComputeResources = sets.NewString(string(corev1.ResourceCPU), string(corev1.ResourceMemory)) - -func isSupportedQoSComputeResource(name corev1.ResourceName) bool { - return supportedQoSComputeResources.Has(string(name)) -} - -func translateTimestampSince(timestamp metav1.Time) string { - if timestamp.IsZero() { - return "" - } - - return duration.HumanDuration(time.Since(timestamp.Time)) -} - -// get values for prometheus metrics -func getTenantMonitoringResponse(session *models.Principal, params operator_api.GetTenantMonitoringParams) (*models.TenantMonitoringInfo, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - - opClient := &operatorClient{ - client: opClientClientSet, - } - - minInst, err := getTenant(ctx, opClient, params.Namespace, params.Tenant) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - return getTenantMonitoring(minInst), nil -} - -func getTenantMonitoring(minInst *miniov2.Tenant) *models.TenantMonitoringInfo { - monitoringInfo := &models.TenantMonitoringInfo{} - - if minInst.Spec.Prometheus != nil { - monitoringInfo.PrometheusEnabled = true - } else { - monitoringInfo.PrometheusEnabled = false - return monitoringInfo - } - - var storageClassName string - if minInst.Spec.Prometheus.StorageClassName != nil { - storageClassName = *minInst.Spec.Prometheus.StorageClassName - monitoringInfo.StorageClassName = storageClassName - } - - var requestedCPU string - var requestedMem string - - if minInst.Spec.Prometheus.Resources.Requests != nil { - // Parse cpu request - if requestedCPUQ, ok := minInst.Spec.Prometheus.Resources.Requests["cpu"]; ok && requestedCPUQ.Value() != 0 { - requestedCPU = strconv.FormatInt(requestedCPUQ.Value(), 10) - monitoringInfo.MonitoringCPURequest = requestedCPU - } - // Parse memory request - if requestedMemQ, ok := minInst.Spec.Prometheus.Resources.Requests["memory"]; ok && requestedMemQ.Value() != 0 { - requestedMem = strconv.FormatInt(requestedMemQ.Value(), 10) - monitoringInfo.MonitoringMemRequest = requestedMem - } - } - - if len(minInst.Spec.Prometheus.Labels) != 0 && minInst.Spec.Prometheus.Labels != nil { - mLabels := []*models.Label{} - for k, v := range minInst.Spec.Prometheus.Labels { - mLabels = append(mLabels, &models.Label{Key: k, Value: v}) - } - monitoringInfo.Labels = mLabels - } - - if len(minInst.Spec.Prometheus.Annotations) != 0 && minInst.Spec.Prometheus.Annotations != nil { - mAnnotations := []*models.Annotation{} - for k, v := range minInst.Spec.Prometheus.Annotations { - mAnnotations = append(mAnnotations, &models.Annotation{Key: k, Value: v}) - } - monitoringInfo.Annotations = mAnnotations - } - - if len(minInst.Spec.Prometheus.NodeSelector) != 0 && minInst.Spec.Prometheus.NodeSelector != nil { - mNodeSelector := []*models.NodeSelector{} - for k, v := range minInst.Spec.Prometheus.NodeSelector { - mNodeSelector = append(mNodeSelector, &models.NodeSelector{Key: k, Value: v}) - } - monitoringInfo.NodeSelector = mNodeSelector - } - - if *minInst.Spec.Prometheus.DiskCapacityDB != 0 { - monitoringInfo.DiskCapacityGB = strconv.Itoa(*minInst.Spec.Prometheus.DiskCapacityDB) - } - if len(minInst.Spec.Prometheus.Image) != 0 { - monitoringInfo.Image = minInst.Spec.Prometheus.Image - } - if len(minInst.Spec.Prometheus.InitImage) != 0 { - monitoringInfo.InitImage = minInst.Spec.Prometheus.InitImage - } - if len(minInst.Spec.Prometheus.ServiceAccountName) != 0 { - monitoringInfo.ServiceAccountName = minInst.Spec.Prometheus.ServiceAccountName - } - if len(minInst.Spec.Prometheus.SideCarImage) != 0 { - monitoringInfo.SidecarImage = minInst.Spec.Prometheus.SideCarImage - } - if minInst.Spec.Prometheus.SecurityContext != nil { - monitoringInfo.SecurityContext = convertK8sSCToModelSC(minInst.Spec.Prometheus.SecurityContext) - } - return monitoringInfo -} - -// sets tenant Prometheus monitoring cofiguration fields to values provided -func setTenantMonitoringResponse(session *models.Principal, params operator_api.SetTenantMonitoringParams) (bool, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err, restapi.ErrUnableToGetTenantUsage) - } - - opClient := &operatorClient{ - client: opClientClientSet, - } - - minTenant, err := getTenant(ctx, opClient, params.Namespace, params.Tenant) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err, restapi.ErrUnableToGetTenantUsage) - } - return setTenantMonitoring(ctx, minTenant, opClient, params) -} - -func setTenantMonitoring(ctx context.Context, minTenant *miniov2.Tenant, opClient OperatorClientI, params operator_api.SetTenantMonitoringParams) (bool, *models.Error) { - if params.Data.Toggle { - if params.Data.PrometheusEnabled { - minTenant.Spec.Prometheus = nil - } else { - promDiskSpaceGB := 5 - promImage := "" - minTenant.Spec.Prometheus = &miniov2.PrometheusConfig{ - DiskCapacityDB: swag.Int(promDiskSpaceGB), - Image: promImage, - } - } - _, err := opClient.TenantUpdate(ctx, minTenant, metav1.UpdateOptions{}) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err) - } - return true, nil - } - - labels := make(map[string]string) - for i := 0; i < len(params.Data.Labels); i++ { - if params.Data.Labels[i] != nil { - labels[params.Data.Labels[i].Key] = params.Data.Labels[i].Value - } - } - annotations := make(map[string]string) - for i := 0; i < len(params.Data.Annotations); i++ { - if params.Data.Annotations[i] != nil { - annotations[params.Data.Annotations[i].Key] = params.Data.Annotations[i].Value - } - } - nodeSelector := make(map[string]string) - for i := 0; i < len(params.Data.NodeSelector); i++ { - if params.Data.NodeSelector[i] != nil { - nodeSelector[params.Data.NodeSelector[i].Key] = params.Data.NodeSelector[i].Value - } - } - - monitoringResourceRequest := make(corev1.ResourceList) - if params.Data.MonitoringCPURequest != "" { - cpuQuantity, err := resource.ParseQuantity(params.Data.MonitoringCPURequest) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err) - } - monitoringResourceRequest["cpu"] = cpuQuantity - } - - if params.Data.MonitoringMemRequest != "" { - memQuantity, err := resource.ParseQuantity(params.Data.MonitoringMemRequest) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err) - } - monitoringResourceRequest["memory"] = memQuantity - } - - minTenant.Spec.Prometheus.Resources.Requests = monitoringResourceRequest - minTenant.Spec.Prometheus.Labels = labels - minTenant.Spec.Prometheus.Annotations = annotations - minTenant.Spec.Prometheus.NodeSelector = nodeSelector - minTenant.Spec.Prometheus.Image = params.Data.Image - minTenant.Spec.Prometheus.SideCarImage = params.Data.SidecarImage - minTenant.Spec.Prometheus.InitImage = params.Data.InitImage - if params.Data.StorageClassName == "" { - minTenant.Spec.Prometheus.StorageClassName = nil - } else { - minTenant.Spec.Prometheus.StorageClassName = ¶ms.Data.StorageClassName - } - - diskCapacityGB, err := strconv.Atoi(params.Data.DiskCapacityGB) - if err == nil { - *minTenant.Spec.Prometheus.DiskCapacityDB = diskCapacityGB - } - - minTenant.Spec.Prometheus.ServiceAccountName = params.Data.ServiceAccountName - minTenant.Spec.Prometheus.SecurityContext, err = convertModelSCToK8sSC(params.Data.SecurityContext) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err) - } - _, err = opClient.TenantUpdate(ctx, minTenant, metav1.UpdateOptions{}) - if err != nil { - return false, restapi.ErrorWithContext(ctx, err) - } - return true, nil -} - -// parseTenantPoolRequest parse pool request and returns the equivalent -// miniov2.Pool object -func parseTenantPoolRequest(poolParams *models.Pool) (*miniov2.Pool, error) { - if poolParams.VolumeConfiguration == nil { - return nil, errors.New("a volume configuration must be specified") - } - - if poolParams.VolumeConfiguration.Size == nil || *poolParams.VolumeConfiguration.Size <= int64(0) { - return nil, errors.New("volume size must be greater than 0") - } - - if poolParams.Servers == nil || *poolParams.Servers <= 0 { - return nil, errors.New("number of servers must be greater than 0") - } - - if poolParams.VolumesPerServer == nil || *poolParams.VolumesPerServer <= 0 { - return nil, errors.New("number of volumes per server must be greater than 0") - } - - volumeSize := resource.NewQuantity(*poolParams.VolumeConfiguration.Size, resource.DecimalExponent) - volTemp := corev1.PersistentVolumeClaimSpec{ - AccessModes: []corev1.PersistentVolumeAccessMode{ - corev1.ReadWriteOnce, - }, - Resources: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - corev1.ResourceStorage: *volumeSize, - }, - }, - } - if poolParams.VolumeConfiguration.StorageClassName != "" { - volTemp.StorageClassName = &poolParams.VolumeConfiguration.StorageClassName - } - - // parse resources' requests - resourcesRequests := make(corev1.ResourceList) - resourcesLimits := make(corev1.ResourceList) - if poolParams.Resources != nil { - for key, val := range poolParams.Resources.Requests { - resourcesRequests[corev1.ResourceName(key)] = *resource.NewQuantity(val, resource.BinarySI) - } - for key, val := range poolParams.Resources.Limits { - resourcesLimits[corev1.ResourceName(key)] = *resource.NewQuantity(val, resource.BinarySI) - } - } - - // parse Node Affinity - nodeSelectorTerms := []corev1.NodeSelectorTerm{} - preferredSchedulingTerm := []corev1.PreferredSchedulingTerm{} - if poolParams.Affinity != nil && poolParams.Affinity.NodeAffinity != nil { - if poolParams.Affinity.NodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution != nil { - for _, elem := range poolParams.Affinity.NodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms { - term := parseModelsNodeSelectorTerm(elem) - nodeSelectorTerms = append(nodeSelectorTerms, term) - } - } - for _, elem := range poolParams.Affinity.NodeAffinity.PreferredDuringSchedulingIgnoredDuringExecution { - pst := corev1.PreferredSchedulingTerm{ - Weight: *elem.Weight, - Preference: parseModelsNodeSelectorTerm(elem.Preference), - } - preferredSchedulingTerm = append(preferredSchedulingTerm, pst) - } - } - var nodeAffinity *corev1.NodeAffinity - if len(nodeSelectorTerms) > 0 || len(preferredSchedulingTerm) > 0 { - nodeAffinity = &corev1.NodeAffinity{ - RequiredDuringSchedulingIgnoredDuringExecution: &corev1.NodeSelector{ - NodeSelectorTerms: nodeSelectorTerms, - }, - PreferredDuringSchedulingIgnoredDuringExecution: preferredSchedulingTerm, - } - } - - // parse Pod Affinity - podAffinityTerms := []corev1.PodAffinityTerm{} - weightedPodAffinityTerms := []corev1.WeightedPodAffinityTerm{} - if poolParams.Affinity != nil && poolParams.Affinity.PodAffinity != nil { - for _, elem := range poolParams.Affinity.PodAffinity.RequiredDuringSchedulingIgnoredDuringExecution { - podAffinityTerms = append(podAffinityTerms, parseModelPodAffinityTerm(elem)) - } - for _, elem := range poolParams.Affinity.PodAffinity.PreferredDuringSchedulingIgnoredDuringExecution { - wAffinityTerm := corev1.WeightedPodAffinityTerm{ - Weight: *elem.Weight, - PodAffinityTerm: parseModelPodAffinityTerm(elem.PodAffinityTerm), - } - weightedPodAffinityTerms = append(weightedPodAffinityTerms, wAffinityTerm) - } - } - var podAffinity *corev1.PodAffinity - if len(podAffinityTerms) > 0 || len(weightedPodAffinityTerms) > 0 { - podAffinity = &corev1.PodAffinity{ - RequiredDuringSchedulingIgnoredDuringExecution: podAffinityTerms, - PreferredDuringSchedulingIgnoredDuringExecution: weightedPodAffinityTerms, - } - } - - // parse Pod Anti Affinity - podAntiAffinityTerms := []corev1.PodAffinityTerm{} - weightedPodAntiAffinityTerms := []corev1.WeightedPodAffinityTerm{} - if poolParams.Affinity != nil && poolParams.Affinity.PodAntiAffinity != nil { - for _, elem := range poolParams.Affinity.PodAntiAffinity.RequiredDuringSchedulingIgnoredDuringExecution { - podAntiAffinityTerms = append(podAntiAffinityTerms, parseModelPodAffinityTerm(elem)) - } - for _, elem := range poolParams.Affinity.PodAntiAffinity.PreferredDuringSchedulingIgnoredDuringExecution { - wAffinityTerm := corev1.WeightedPodAffinityTerm{ - Weight: *elem.Weight, - PodAffinityTerm: parseModelPodAffinityTerm(elem.PodAffinityTerm), - } - weightedPodAntiAffinityTerms = append(weightedPodAntiAffinityTerms, wAffinityTerm) - } - } - var podAntiAffinity *corev1.PodAntiAffinity - if len(podAntiAffinityTerms) > 0 || len(weightedPodAntiAffinityTerms) > 0 { - podAntiAffinity = &corev1.PodAntiAffinity{ - RequiredDuringSchedulingIgnoredDuringExecution: podAntiAffinityTerms, - PreferredDuringSchedulingIgnoredDuringExecution: weightedPodAntiAffinityTerms, - } - } - - var affinity *corev1.Affinity - if nodeAffinity != nil || podAffinity != nil || podAntiAffinity != nil { - affinity = &corev1.Affinity{ - NodeAffinity: nodeAffinity, - PodAffinity: podAffinity, - PodAntiAffinity: podAntiAffinity, - } - } - - // parse tolerations - tolerations := []corev1.Toleration{} - for _, elem := range poolParams.Tolerations { - var tolerationSeconds *int64 - if elem.TolerationSeconds != nil { - // elem.TolerationSeconds.Seconds is allowed to be nil - tolerationSeconds = elem.TolerationSeconds.Seconds - } - - toleration := corev1.Toleration{ - Key: elem.Key, - Operator: corev1.TolerationOperator(elem.Operator), - Value: elem.Value, - Effect: corev1.TaintEffect(elem.Effect), - TolerationSeconds: tolerationSeconds, - } - tolerations = append(tolerations, toleration) - } - - // Pass annotations to the volume - vct := &corev1.PersistentVolumeClaim{ - ObjectMeta: metav1.ObjectMeta{ - Name: "data", - Labels: poolParams.VolumeConfiguration.Labels, - Annotations: poolParams.VolumeConfiguration.Annotations, - }, - Spec: volTemp, - } - - pool := &miniov2.Pool{ - Name: poolParams.Name, - Servers: int32(*poolParams.Servers), - VolumesPerServer: *poolParams.VolumesPerServer, - VolumeClaimTemplate: vct, - Resources: corev1.ResourceRequirements{ - Requests: resourcesRequests, - Limits: resourcesLimits, - }, - NodeSelector: poolParams.NodeSelector, - Affinity: affinity, - Tolerations: tolerations, - RuntimeClassName: &poolParams.RuntimeClassName, - } - // if security context for Tenant is present, configure it. - if poolParams.SecurityContext != nil { - sc, err := convertModelSCToK8sSC(poolParams.SecurityContext) - if err != nil { - return nil, err - } - pool.SecurityContext = sc - } - return pool, nil -} - -func parseModelPodAffinityTerm(term *models.PodAffinityTerm) corev1.PodAffinityTerm { - labelMatchExpressions := []metav1.LabelSelectorRequirement{} - for _, exp := range term.LabelSelector.MatchExpressions { - labelSelectorReq := metav1.LabelSelectorRequirement{ - Key: *exp.Key, - Operator: metav1.LabelSelectorOperator(*exp.Operator), - Values: exp.Values, - } - labelMatchExpressions = append(labelMatchExpressions, labelSelectorReq) - } - - podAffinityTerm := corev1.PodAffinityTerm{ - LabelSelector: &metav1.LabelSelector{ - MatchExpressions: labelMatchExpressions, - MatchLabels: term.LabelSelector.MatchLabels, - }, - Namespaces: term.Namespaces, - TopologyKey: *term.TopologyKey, - } - return podAffinityTerm -} - -func parseModelsNodeSelectorTerm(elem *models.NodeSelectorTerm) corev1.NodeSelectorTerm { - var term corev1.NodeSelectorTerm - for _, matchExpression := range elem.MatchExpressions { - matchExp := corev1.NodeSelectorRequirement{ - Key: *matchExpression.Key, - Operator: corev1.NodeSelectorOperator(*matchExpression.Operator), - Values: matchExpression.Values, - } - term.MatchExpressions = append(term.MatchExpressions, matchExp) - } - for _, matchField := range elem.MatchFields { - matchF := corev1.NodeSelectorRequirement{ - Key: *matchField.Key, - Operator: corev1.NodeSelectorOperator(*matchField.Operator), - Values: matchField.Values, - } - term.MatchFields = append(term.MatchFields, matchF) - } - return term -} - -// parseTenantPool miniov2 pool object and returns the equivalent -// models.Pool object -func parseTenantPool(pool *miniov2.Pool) *models.Pool { - var size *int64 - var storageClassName string - if pool.VolumeClaimTemplate != nil { - size = swag.Int64(pool.VolumeClaimTemplate.Spec.Resources.Requests.Storage().Value()) - if pool.VolumeClaimTemplate.Spec.StorageClassName != nil { - storageClassName = *pool.VolumeClaimTemplate.Spec.StorageClassName - } - } - - // parse resources' requests - var resources *models.PoolResources - resourcesRequests := make(map[string]int64) - resourcesLimits := make(map[string]int64) - for key, val := range pool.Resources.Requests { - resourcesRequests[key.String()] = val.Value() - } - for key, val := range pool.Resources.Limits { - resourcesLimits[key.String()] = val.Value() - } - if len(resourcesRequests) > 0 || len(resourcesLimits) > 0 { - resources = &models.PoolResources{ - Limits: resourcesLimits, - Requests: resourcesRequests, - } - } - - // parse Node Affinity - nodeSelectorTerms := []*models.NodeSelectorTerm{} - preferredSchedulingTerm := []*models.PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0{} - - if pool.Affinity != nil && pool.Affinity.NodeAffinity != nil { - if pool.Affinity.NodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution != nil { - for _, elem := range pool.Affinity.NodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms { - term := parseNodeSelectorTerm(&elem) - nodeSelectorTerms = append(nodeSelectorTerms, term) - } - } - for _, elem := range pool.Affinity.NodeAffinity.PreferredDuringSchedulingIgnoredDuringExecution { - pst := &models.PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0{ - Weight: swag.Int32(elem.Weight), - Preference: parseNodeSelectorTerm(&elem.Preference), - } - preferredSchedulingTerm = append(preferredSchedulingTerm, pst) - } - } - - var nodeAffinity *models.PoolAffinityNodeAffinity - if len(nodeSelectorTerms) > 0 || len(preferredSchedulingTerm) > 0 { - nodeAffinity = &models.PoolAffinityNodeAffinity{ - RequiredDuringSchedulingIgnoredDuringExecution: &models.PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution{ - NodeSelectorTerms: nodeSelectorTerms, - }, - PreferredDuringSchedulingIgnoredDuringExecution: preferredSchedulingTerm, - } - } - - // parse Pod Affinity - podAffinityTerms := []*models.PodAffinityTerm{} - weightedPodAffinityTerms := []*models.PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0{} - - if pool.Affinity != nil && pool.Affinity.PodAffinity != nil { - for _, elem := range pool.Affinity.PodAffinity.RequiredDuringSchedulingIgnoredDuringExecution { - podAffinityTerms = append(podAffinityTerms, parsePodAffinityTerm(&elem)) - } - for _, elem := range pool.Affinity.PodAffinity.PreferredDuringSchedulingIgnoredDuringExecution { - wAffinityTerm := &models.PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0{ - Weight: swag.Int32(elem.Weight), - PodAffinityTerm: parsePodAffinityTerm(&elem.PodAffinityTerm), - } - weightedPodAffinityTerms = append(weightedPodAffinityTerms, wAffinityTerm) - } - } - var podAffinity *models.PoolAffinityPodAffinity - if len(podAffinityTerms) > 0 || len(weightedPodAffinityTerms) > 0 { - podAffinity = &models.PoolAffinityPodAffinity{ - RequiredDuringSchedulingIgnoredDuringExecution: podAffinityTerms, - PreferredDuringSchedulingIgnoredDuringExecution: weightedPodAffinityTerms, - } - } - - // parse Pod Anti Affinity - podAntiAffinityTerms := []*models.PodAffinityTerm{} - weightedPodAntiAffinityTerms := []*models.PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0{} - - if pool.Affinity != nil && pool.Affinity.PodAntiAffinity != nil { - for _, elem := range pool.Affinity.PodAntiAffinity.RequiredDuringSchedulingIgnoredDuringExecution { - podAntiAffinityTerms = append(podAntiAffinityTerms, parsePodAffinityTerm(&elem)) - } - for _, elem := range pool.Affinity.PodAntiAffinity.PreferredDuringSchedulingIgnoredDuringExecution { - wAffinityTerm := &models.PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0{ - Weight: swag.Int32(elem.Weight), - PodAffinityTerm: parsePodAffinityTerm(&elem.PodAffinityTerm), - } - weightedPodAntiAffinityTerms = append(weightedPodAntiAffinityTerms, wAffinityTerm) - } - } - - var podAntiAffinity *models.PoolAffinityPodAntiAffinity - if len(podAntiAffinityTerms) > 0 || len(weightedPodAntiAffinityTerms) > 0 { - podAntiAffinity = &models.PoolAffinityPodAntiAffinity{ - RequiredDuringSchedulingIgnoredDuringExecution: podAntiAffinityTerms, - PreferredDuringSchedulingIgnoredDuringExecution: weightedPodAntiAffinityTerms, - } - } - - // build affinity object - var affinity *models.PoolAffinity - if nodeAffinity != nil || podAffinity != nil || podAntiAffinity != nil { - affinity = &models.PoolAffinity{ - NodeAffinity: nodeAffinity, - PodAffinity: podAffinity, - PodAntiAffinity: podAntiAffinity, - } - } - - // parse tolerations - var tolerations models.PoolTolerations - for _, elem := range pool.Tolerations { - var tolerationSecs *models.PoolTolerationSeconds - if elem.TolerationSeconds != nil { - tolerationSecs = &models.PoolTolerationSeconds{ - Seconds: elem.TolerationSeconds, - } - } - toleration := &models.PoolTolerationsItems0{ - Key: elem.Key, - Operator: string(elem.Operator), - Value: elem.Value, - Effect: string(elem.Effect), - TolerationSeconds: tolerationSecs, - } - tolerations = append(tolerations, toleration) - } - - var securityContext models.SecurityContext - - if pool.SecurityContext != nil { - var fsGroup string - var runAsGroup string - var runAsUser string - var fsGroupChangePolicy string - if pool.SecurityContext.FSGroup != nil { - fsGroup = strconv.Itoa(int(*pool.SecurityContext.FSGroup)) - } - if pool.SecurityContext.RunAsGroup != nil { - runAsGroup = strconv.Itoa(int(*pool.SecurityContext.RunAsGroup)) - } - if pool.SecurityContext.RunAsUser != nil { - runAsUser = strconv.Itoa(int(*pool.SecurityContext.RunAsUser)) - } - if pool.SecurityContext.FSGroupChangePolicy != nil { - fsGroupChangePolicy = string(*pool.SecurityContext.FSGroupChangePolicy) - } - securityContext = models.SecurityContext{ - FsGroup: fsGroup, - RunAsGroup: &runAsGroup, - RunAsNonRoot: pool.SecurityContext.RunAsNonRoot, - RunAsUser: &runAsUser, - FsGroupChangePolicy: fsGroupChangePolicy, - } - } - - var runtimeClassName string - if pool.RuntimeClassName != nil { - runtimeClassName = *pool.RuntimeClassName - } - - poolModel := &models.Pool{ - Name: pool.Name, - Servers: swag.Int64(int64(pool.Servers)), - VolumesPerServer: swag.Int32(pool.VolumesPerServer), - VolumeConfiguration: &models.PoolVolumeConfiguration{ - Size: size, - StorageClassName: storageClassName, - }, - NodeSelector: pool.NodeSelector, - Resources: resources, - Affinity: affinity, - Tolerations: tolerations, - SecurityContext: &securityContext, - RuntimeClassName: runtimeClassName, - } - return poolModel -} - -func parsePodAffinityTerm(term *corev1.PodAffinityTerm) *models.PodAffinityTerm { - labelMatchExpressions := []*models.PodAffinityTermLabelSelectorMatchExpressionsItems0{} - for _, exp := range term.LabelSelector.MatchExpressions { - labelSelectorReq := &models.PodAffinityTermLabelSelectorMatchExpressionsItems0{ - Key: swag.String(exp.Key), - Operator: swag.String(string(exp.Operator)), - Values: exp.Values, - } - labelMatchExpressions = append(labelMatchExpressions, labelSelectorReq) - } - - podAffinityTerm := &models.PodAffinityTerm{ - LabelSelector: &models.PodAffinityTermLabelSelector{ - MatchExpressions: labelMatchExpressions, - MatchLabels: term.LabelSelector.MatchLabels, - }, - Namespaces: term.Namespaces, - TopologyKey: swag.String(term.TopologyKey), - } - return podAffinityTerm -} - -func parseNodeSelectorTerm(term *corev1.NodeSelectorTerm) *models.NodeSelectorTerm { - var t models.NodeSelectorTerm - for _, matchExpression := range term.MatchExpressions { - matchExp := &models.NodeSelectorTermMatchExpressionsItems0{ - Key: swag.String(matchExpression.Key), - Operator: swag.String(string(matchExpression.Operator)), - Values: matchExpression.Values, - } - t.MatchExpressions = append(t.MatchExpressions, matchExp) - } - for _, matchField := range term.MatchFields { - matchF := &models.NodeSelectorTermMatchFieldsItems0{ - Key: swag.String(matchField.Key), - Operator: swag.String(string(matchField.Operator)), - Values: matchField.Values, - } - t.MatchFields = append(t.MatchFields, matchF) - } - return &t -} - -func getTenantUpdatePoolResponse(session *models.Principal, params operator_api.TenantUpdatePoolsParams) (*models.Tenant, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - - opClient := &operatorClient{ - client: opClientClientSet, - } - - tenant, err := updateTenantPools(ctx, opClient, params.Namespace, params.Tenant, params.Body.Pools) - if err != nil { - restapi.LogError("error updating Tenant's pools: %v", err) - return nil, restapi.ErrorWithContext(ctx, err) - } - return tenant, nil -} - -// updateTenantPools Sets the Tenant's pools to the ones provided by the request -// -// It does the equivalent to a PUT request on Tenant's pools -func updateTenantPools( - ctx context.Context, - operatorClient OperatorClientI, - namespace string, - tenantName string, - poolsReq []*models.Pool, -) (*models.Tenant, error) { - minInst, err := operatorClient.TenantGet(ctx, namespace, tenantName, metav1.GetOptions{}) - if err != nil { - return nil, err - } - - // set the pools if they are provided - var newPoolArray []miniov2.Pool - for _, pool := range poolsReq { - pool, err := parseTenantPoolRequest(pool) - if err != nil { - return nil, err - } - newPoolArray = append(newPoolArray, *pool) - } - - // replace pools array - minInst.Spec.Pools = newPoolArray - - minInst = minInst.DeepCopy() - minInst.EnsureDefaults() - - payloadBytes, err := json.Marshal(minInst) - if err != nil { - return nil, err - } - tenantUpdated, err := operatorClient.TenantPatch(ctx, namespace, minInst.Name, types.MergePatchType, payloadBytes, metav1.PatchOptions{}) - if err != nil { - return nil, err - } - return getTenantInfo(tenantUpdated), nil -} - -func getTenantYAML(session *models.Principal, params operator_api.GetTenantYAMLParams) (*models.TenantYAML, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - // get Kubernetes Client - opClient, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - tenant, err := opClient.MinioV2().Tenants(params.Namespace).Get(params.HTTPRequest.Context(), params.Tenant, metav1.GetOptions{}) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - // remove managed fields - tenant.ManagedFields = []metav1.ManagedFieldsEntry{} - // yb, err := yaml.Marshal(tenant) - j8sJSONSerializer := k8sJson.NewSerializerWithOptions( - k8sJson.DefaultMetaFactory, nil, nil, - k8sJson.SerializerOptions{ - Yaml: true, - Pretty: true, - Strict: true, - }, - ) - buf := new(bytes.Buffer) - - err = j8sJSONSerializer.Encode(tenant, buf) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - - yb := buf.String() - - return &models.TenantYAML{Yaml: yb}, nil -} - -func getUpdateTenantYAML(session *models.Principal, params operator_api.PutTenantYAMLParams) *models.Error { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - // https://godoc.org/k8s.io/apimachinery/pkg/runtime#Scheme - scheme := runtime.NewScheme() - - // https://godoc.org/k8s.io/apimachinery/pkg/runtime/serializer#CodecFactory - codecFactory := serializer.NewCodecFactory(scheme) - - // https://godoc.org/k8s.io/apimachinery/pkg/runtime#Decoder - deserializer := codecFactory.UniversalDeserializer() - - tenantObject, _, err := deserializer.Decode([]byte(params.Body.Yaml), nil, &miniov2.Tenant{}) - if err != nil { - return &models.Error{Code: 400, Message: swag.String(err.Error())} - } - inTenant := tenantObject.(*miniov2.Tenant) - // get Kubernetes Client - opClient, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - - tenant, err := opClient.MinioV2().Tenants(params.Namespace).Get(params.HTTPRequest.Context(), params.Tenant, metav1.GetOptions{}) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - upTenant := tenant.DeepCopy() - // only update safe fields: spec, metadata.finalizers, metadata.labels and metadata.annotations - upTenant.Labels = inTenant.Labels - upTenant.Annotations = inTenant.Annotations - upTenant.Finalizers = inTenant.Finalizers - upTenant.Spec = inTenant.Spec - - _, err = opClient.MinioV2().Tenants(upTenant.Namespace).Update(params.HTTPRequest.Context(), upTenant, metav1.UpdateOptions{}) - if err != nil { - return &models.Error{Code: 400, Message: swag.String(err.Error())} - } - - return nil -} - -func getTenantEventsResponse(session *models.Principal, params operator_api.GetTenantEventsParams) (models.EventListWrapper, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - client, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - clientset, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - tenant, err := client.MinioV2().Tenants(params.Namespace).Get(ctx, params.Tenant, metav1.GetOptions{}) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - events, err := clientset.CoreV1().Events(params.Namespace).List(ctx, metav1.ListOptions{FieldSelector: fmt.Sprintf("involvedObject.uid=%s", tenant.UID)}) - if err != nil { - return nil, restapi.ErrorWithContext(ctx, err) - } - retval := models.EventListWrapper{} - for _, event := range events.Items { - retval = append(retval, &models.EventListElement{ - Namespace: event.Namespace, - LastSeen: event.LastTimestamp.Unix(), - Message: event.Message, - EventType: event.Type, - Reason: event.Reason, - }) - } - sort.SliceStable(retval, func(i int, j int) bool { - return retval[i].LastSeen < retval[j].LastSeen - }) - return retval, nil -} - -func getUpdateDomainsResponse(session *models.Principal, params operator_api.UpdateTenantDomainsParams) *models.Error { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - operatorCli, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - - opClient := &operatorClient{ - client: operatorCli, - } - - err = updateTenantDomains(ctx, opClient, params.Namespace, params.Tenant, params.Body.Domains) - - if err != nil { - return restapi.ErrorWithContext(ctx, err) - } - - return nil -} - -func updateTenantDomains(ctx context.Context, operatorClient OperatorClientI, namespace string, tenantName string, domainConfig *models.DomainsConfiguration) error { - minTenant, err := getTenant(ctx, operatorClient, namespace, tenantName) - if err != nil { - return err - } - - var features miniov2.Features - var domains miniov2.TenantDomains - - // We include current value for BucketDNS. Domains will be overwritten as we are passing all the values that must be saved. - if minTenant.Spec.Features != nil { - features = miniov2.Features{ - BucketDNS: minTenant.Spec.Features.BucketDNS, - } - } - - if domainConfig != nil { - // tenant domains - if domainConfig.Console != "" { - domains.Console = domainConfig.Console - } - - if domainConfig.Minio != nil { - domains.Minio = domainConfig.Minio - } - - features.Domains = &domains - } - - minTenant.Spec.Features = &features - - _, err = operatorClient.TenantUpdate(ctx, minTenant, metav1.UpdateOptions{}) - - return err -} diff --git a/operatorapi/tenants_2_test.go b/operatorapi/tenants_2_test.go deleted file mode 100644 index 2dd7c4fbf..000000000 --- a/operatorapi/tenants_2_test.go +++ /dev/null @@ -1,2026 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "errors" - "fmt" - "net/http" - "strings" - "testing" - "time" - - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations" - "github.com/minio/console/operatorapi/operations/operator_api" - "github.com/minio/console/pkg/kes" - "github.com/minio/console/restapi" - "github.com/minio/madmin-go/v2" - miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/suite" - "gopkg.in/yaml.v2" - corev1 "k8s.io/api/core/v1" - v1 "k8s.io/api/core/v1" - k8sErrors "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" -) - -type TenantTestSuite struct { - suite.Suite - assert *assert.Assertions - opClient opClientMock - k8sclient k8sClientMock - adminClient restapi.AdminClientMock -} - -func (suite *TenantTestSuite) SetupSuite() { - suite.assert = assert.New(suite.T()) - suite.opClient = opClientMock{} - suite.k8sclient = k8sClientMock{} - suite.adminClient = restapi.AdminClientMock{} - k8sClientDeleteSecretsCollectionMock = func(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return nil - } -} - -func (suite *TenantTestSuite) SetupTest() { -} - -func (suite *TenantTestSuite) TearDownSuite() { -} - -func (suite *TenantTestSuite) TearDownTest() { -} - -func (suite *TenantTestSuite) TestRegisterTenantLogsHandlers() { - api := &operations.OperatorAPI{} - suite.assertHandlersAreNil(api) - registerTenantHandlers(api) - suite.assertHandlersAreNotNil(api) -} - -func (suite *TenantTestSuite) assertHandlersAreNil(api *operations.OperatorAPI) { - suite.assert.Nil(api.OperatorAPICreateTenantHandler) - suite.assert.Nil(api.OperatorAPIListAllTenantsHandler) - suite.assert.Nil(api.OperatorAPIListTenantsHandler) - suite.assert.Nil(api.OperatorAPITenantDetailsHandler) - suite.assert.Nil(api.OperatorAPITenantConfigurationHandler) - suite.assert.Nil(api.OperatorAPIUpdateTenantConfigurationHandler) - suite.assert.Nil(api.OperatorAPITenantSecurityHandler) - suite.assert.Nil(api.OperatorAPIUpdateTenantSecurityHandler) - suite.assert.Nil(api.OperatorAPISetTenantAdministratorsHandler) - suite.assert.Nil(api.OperatorAPITenantIdentityProviderHandler) - suite.assert.Nil(api.OperatorAPIUpdateTenantIdentityProviderHandler) - suite.assert.Nil(api.OperatorAPIDeleteTenantHandler) - suite.assert.Nil(api.OperatorAPIDeletePodHandler) - suite.assert.Nil(api.OperatorAPIUpdateTenantHandler) - suite.assert.Nil(api.OperatorAPITenantAddPoolHandler) - suite.assert.Nil(api.OperatorAPIGetTenantUsageHandler) - suite.assert.Nil(api.OperatorAPIGetTenantPodsHandler) - suite.assert.Nil(api.OperatorAPIGetPodLogsHandler) - suite.assert.Nil(api.OperatorAPIGetPodEventsHandler) - suite.assert.Nil(api.OperatorAPIDescribePodHandler) - suite.assert.Nil(api.OperatorAPIGetTenantMonitoringHandler) - suite.assert.Nil(api.OperatorAPISetTenantMonitoringHandler) - suite.assert.Nil(api.OperatorAPITenantUpdatePoolsHandler) - suite.assert.Nil(api.OperatorAPITenantUpdateCertificateHandler) - suite.assert.Nil(api.OperatorAPITenantUpdateEncryptionHandler) - suite.assert.Nil(api.OperatorAPITenantDeleteEncryptionHandler) - suite.assert.Nil(api.OperatorAPITenantEncryptionInfoHandler) - suite.assert.Nil(api.OperatorAPIGetTenantYAMLHandler) - suite.assert.Nil(api.OperatorAPIPutTenantYAMLHandler) - suite.assert.Nil(api.OperatorAPIGetTenantEventsHandler) - suite.assert.Nil(api.OperatorAPIUpdateTenantDomainsHandler) -} - -func (suite *TenantTestSuite) assertHandlersAreNotNil(api *operations.OperatorAPI) { - suite.assert.NotNil(api.OperatorAPICreateTenantHandler) - suite.assert.NotNil(api.OperatorAPIListAllTenantsHandler) - suite.assert.NotNil(api.OperatorAPIListTenantsHandler) - suite.assert.NotNil(api.OperatorAPITenantDetailsHandler) - suite.assert.NotNil(api.OperatorAPITenantConfigurationHandler) - suite.assert.NotNil(api.OperatorAPIUpdateTenantConfigurationHandler) - suite.assert.NotNil(api.OperatorAPITenantSecurityHandler) - suite.assert.NotNil(api.OperatorAPIUpdateTenantSecurityHandler) - suite.assert.NotNil(api.OperatorAPISetTenantAdministratorsHandler) - suite.assert.NotNil(api.OperatorAPITenantIdentityProviderHandler) - suite.assert.NotNil(api.OperatorAPIUpdateTenantIdentityProviderHandler) - suite.assert.NotNil(api.OperatorAPIDeleteTenantHandler) - suite.assert.NotNil(api.OperatorAPIDeletePodHandler) - suite.assert.NotNil(api.OperatorAPIUpdateTenantHandler) - suite.assert.NotNil(api.OperatorAPITenantAddPoolHandler) - suite.assert.NotNil(api.OperatorAPIGetTenantUsageHandler) - suite.assert.NotNil(api.OperatorAPIGetTenantPodsHandler) - suite.assert.NotNil(api.OperatorAPIGetPodLogsHandler) - suite.assert.NotNil(api.OperatorAPIGetPodEventsHandler) - suite.assert.NotNil(api.OperatorAPIDescribePodHandler) - suite.assert.NotNil(api.OperatorAPIGetTenantMonitoringHandler) - suite.assert.NotNil(api.OperatorAPISetTenantMonitoringHandler) - suite.assert.NotNil(api.OperatorAPITenantUpdatePoolsHandler) - suite.assert.NotNil(api.OperatorAPITenantUpdateCertificateHandler) - suite.assert.NotNil(api.OperatorAPITenantUpdateEncryptionHandler) - suite.assert.NotNil(api.OperatorAPITenantDeleteEncryptionHandler) - suite.assert.NotNil(api.OperatorAPITenantEncryptionInfoHandler) - suite.assert.NotNil(api.OperatorAPIGetTenantYAMLHandler) - suite.assert.NotNil(api.OperatorAPIPutTenantYAMLHandler) - suite.assert.NotNil(api.OperatorAPIGetTenantEventsHandler) - suite.assert.NotNil(api.OperatorAPIUpdateTenantDomainsHandler) -} - -func (suite *TenantTestSuite) TestCreateTenantHandlerWithError() { - params, api := suite.initCreateTenantRequest() - response := api.OperatorAPICreateTenantHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.CreateTenantDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) TestCreateTenantWithWrongECP() { - params, _ := suite.initCreateTenantRequest() - params.Body.ErasureCodingParity = 1 - k8sClientCreateSecretMock = func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) { - return nil, nil - } - _, err := createTenant(context.Background(), params, suite.k8sclient, &models.Principal{}) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestCreateTenantWithWrongActiveDirectoryConfig() { - params, _ := suite.initCreateTenantRequest() - params.Body.ErasureCodingParity = 2 - url := "mock-url" - lookup := "mock-lookup" - params.Body.Idp = &models.IdpConfiguration{ - ActiveDirectory: &models.IdpConfigurationActiveDirectory{ - SkipTLSVerification: true, - ServerInsecure: true, - ServerStartTLS: true, - UserDNS: []string{"mock-user"}, - URL: &url, - LookupBindDn: &lookup, - }, - } - k8sClientCreateSecretMock = func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) { - if strings.HasPrefix(secret.Name, fmt.Sprintf("%s-user-", *params.Body.Name)) { - return nil, errors.New("mock-create-error") - } - - return nil, nil - } - _, err := createTenant(context.Background(), params, suite.k8sclient, &models.Principal{}) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestCreateTenantWithWrongBuiltInUsers() { - params, _ := suite.initCreateTenantRequest() - accessKey := "mock-access-key" - secretKey := "mock-secret-key" - params.Body.Idp = &models.IdpConfiguration{ - Keys: []*models.IdpConfigurationKeysItems0{ - { - AccessKey: &accessKey, - SecretKey: &secretKey, - }, - }, - } - k8sClientCreateSecretMock = func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) { - if strings.HasPrefix(secret.Name, fmt.Sprintf("%s-user-", *params.Body.Name)) { - return nil, errors.New("mock-create-error") - } - return nil, nil - } - _, err := createTenant(context.Background(), params, suite.k8sclient, &models.Principal{}) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestCreateTenantWithOIDCAndWrongServerCertificates() { - params, _ := suite.initCreateTenantRequest() - url := "mock-url" - clientID := "mock-client-id" - clientSecret := "mock-client-secret" - claimName := "mock-claim-name" - crt := "mock-crt" - key := "mock-key" - params.Body.Idp = &models.IdpConfiguration{ - Oidc: &models.IdpConfigurationOidc{ - ClientID: &clientID, - SecretID: &clientSecret, - ClaimName: &claimName, - ConfigurationURL: &url, - }, - } - params.Body.TLS = &models.TLSConfiguration{ - MinioServerCertificates: []*models.KeyPairConfiguration{ - { - Crt: &crt, - Key: &key, - }, - }, - } - k8sClientDeleteSecretMock = func(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error { - return nil - } - _, err := createTenant(context.Background(), params, suite.k8sclient, &models.Principal{}) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestCreateTenantWithWrongClientCertificates() { - params, _ := suite.initCreateTenantRequest() - crt := "mock-crt" - key := "mock-key" - params.Body.TLS = &models.TLSConfiguration{ - MinioClientCertificates: []*models.KeyPairConfiguration{ - { - Crt: &crt, - Key: &key, - }, - }, - } - k8sClientDeleteSecretMock = func(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error { - return nil - } - _, err := createTenant(context.Background(), params, suite.k8sclient, &models.Principal{}) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestCreateTenantWithWrongCAsCertificates() { - params, _ := suite.initCreateTenantRequest() - params.Body.TLS = &models.TLSConfiguration{ - MinioCAsCertificates: []string{"bW9jay1jcnQ="}, - } - k8sClientDeleteSecretMock = func(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error { - return nil - } - k8sClientCreateSecretMock = func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) { - if strings.HasPrefix(secret.Name, fmt.Sprintf("%s-ca-certificate-", *params.Body.Name)) { - return nil, errors.New("mock-create-error") - } - return nil, nil - } - _, err := createTenant(context.Background(), params, suite.k8sclient, &models.Principal{}) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestCreateTenantWithWrongMtlsCertificates() { - params, _ := suite.initCreateTenantRequest() - crt := "mock-crt" - key := "mock-key" - enableTLS := true - params.Body.EnableTLS = &enableTLS - params.Body.Encryption = &models.EncryptionConfiguration{ - MinioMtls: &models.KeyPairConfiguration{ - Crt: &crt, - Key: &key, - }, - } - k8sClientDeleteSecretMock = func(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error { - return nil - } - _, err := createTenant(context.Background(), params, suite.k8sclient, &models.Principal{}) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestCreateTenantWithWrongKESConfig() { - params, _ := suite.initCreateTenantRequest() - crt := "mock-crt" - key := "mock-key" - enableTLS := true - params.Body.EnableTLS = &enableTLS - params.Body.Encryption = &models.EncryptionConfiguration{ - ServerTLS: &models.KeyPairConfiguration{ - Crt: &crt, - Key: &key, - }, - Image: "mock-image", - Replicas: "1", - } - k8sClientDeleteSecretMock = func(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error { - return nil - } - _, err := createTenant(context.Background(), params, suite.k8sclient, &models.Principal{}) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestCreateTenantWithWrongPool() { - params, _ := suite.initCreateTenantRequest() - params.Body.Annotations = map[string]string{"mock": "mock"} - params.Body.Pools = []*models.Pool{{}} - k8sClientCreateSecretMock = func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) { - return nil, nil - } - k8sClientDeleteSecretMock = func(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error { - return nil - } - _, err := createTenant(context.Background(), params, suite.k8sclient, &models.Principal{}) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestCreateTenantWithImageRegistryCreateError() { - params, _ := suite.initCreateTenantRequest() - params.Body.MountPath = "/mock-path" - registry := "mock-registry" - username := "mock-username" - password := "mock-password" - params.Body.ImageRegistry = &models.ImageRegistry{ - Registry: ®istry, - Username: &username, - Password: &password, - } - - k8sClientCreateSecretMock = func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) { - if strings.HasPrefix(secret.Name, fmt.Sprintf("%s-secret", *params.Body.Name)) { - return nil, nil - } - return nil, errors.New("mock-create-error") - } - k8sclientGetSecretMock = func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return nil, k8sErrors.NewNotFound(schema.GroupResource{}, "") - } - _, err := createTenant(context.Background(), params, suite.k8sclient, &models.Principal{}) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestCreateTenantWithImageRegistryUpdateError() { - params, _ := suite.initCreateTenantRequest() - registry := "mock-registry" - username := "mock-username" - password := "mock-password" - params.Body.ImageRegistry = &models.ImageRegistry{ - Registry: ®istry, - Username: &username, - Password: &password, - } - k8sClientCreateSecretMock = func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) { - return nil, nil - } - k8sClientUpdateSecretMock = func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.UpdateOptions) (*v1.Secret, error) { - return nil, errors.New("mock-update-error") - } - k8sclientGetSecretMock = func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return &v1.Secret{}, nil - } - _, err := createTenant(context.Background(), params, suite.k8sclient, &models.Principal{}) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) initCreateTenantRequest() (params operator_api.CreateTenantParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - ns := "mock-namespace" - name := "mock-tenant-name" - params.Body = &models.CreateTenantRequest{ - Image: "", - Namespace: &ns, - Name: &name, - } - return params, api -} - -func (suite *TenantTestSuite) TestListAllTenantsHandlerWithoutError() { - params, api := suite.initListAllTenantsRequest() - response := api.OperatorAPIListAllTenantsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.ListTenantsDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initListAllTenantsRequest() (params operator_api.ListAllTenantsParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - return params, api -} - -func (suite *TenantTestSuite) TestListTenantsHandlerWithoutError() { - params, api := suite.initListTenantsRequest() - response := api.OperatorAPIListTenantsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.ListTenantsDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initListTenantsRequest() (params operator_api.ListTenantsParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - return params, api -} - -func (suite *TenantTestSuite) TestTenantDetailsHandlerWithError() { - params, api := suite.initTenantDetailsRequest() - response := api.OperatorAPITenantDetailsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.TenantDetailsDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initTenantDetailsRequest() (params operator_api.TenantDetailsParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - return params, api -} - -func (suite *TenantTestSuite) TestTenantConfigurationHandlerWithError() { - params, api := suite.initTenantConfigurationRequest() - response := api.OperatorAPITenantConfigurationHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.TenantConfigurationDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initTenantConfigurationRequest() (params operator_api.TenantConfigurationParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - return params, api -} - -func (suite *TenantTestSuite) TestParseTenantConfigurationWithoutError() { - tenant := &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - Env: []corev1.EnvVar{ - {Name: "mock", Value: "mock-env"}, - {Name: "mock", Value: "mock-env-2"}, - }, - }, - } - config, err := parseTenantConfiguration(context.Background(), suite.k8sclient, tenant) - suite.assert.NotNil(config) - suite.assert.Nil(err) -} - -func (suite *TenantTestSuite) TestUpdateTenantConfigurationHandlerWithError() { - params, api := suite.initUpdateTenantConfigurationRequest() - response := api.OperatorAPIUpdateTenantConfigurationHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.UpdateTenantConfigurationDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initUpdateTenantConfigurationRequest() (params operator_api.UpdateTenantConfigurationParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - return params, api -} - -func (suite *TenantTestSuite) TestTenantSecurityHandlerWithError() { - params, api := suite.initTenantSecurityRequest() - response := api.OperatorAPITenantSecurityHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.TenantSecurityDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initTenantSecurityRequest() (params operator_api.TenantSecurityParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - return params, api -} - -func (suite *TenantTestSuite) TestGetTenantSecurityWithWrongServerCertificates() { - ctx := context.Background() - tenant := &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Name: "mock-tenant", - Namespace: "mock-namespace", - }, - Spec: miniov2.TenantSpec{ - ExternalCertSecret: []*miniov2.LocalCertificateReference{{}}, - }, - } - k8sclientGetSecretMock = func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return nil, errors.New("mock-get-error") - } - _, err := getTenantSecurity(ctx, suite.k8sclient, tenant) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestGetTenantSecurityWithWrongClientCertificates() { - ctx := context.Background() - tenant := &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Name: "mock-tenant", - Namespace: "mock-namespace", - }, - Spec: miniov2.TenantSpec{ - ExternalClientCertSecrets: []*miniov2.LocalCertificateReference{{}}, - }, - } - k8sclientGetSecretMock = func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return nil, errors.New("mock-get-error") - } - _, err := getTenantSecurity(ctx, suite.k8sclient, tenant) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestGetTenantSecurityWithWrongCACertificates() { - ctx := context.Background() - tenant := &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Name: "mock-tenant", - Namespace: "mock-namespace", - }, - Spec: miniov2.TenantSpec{ - ExternalCaCertSecret: []*miniov2.LocalCertificateReference{{}}, - }, - } - k8sclientGetSecretMock = func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return nil, errors.New("mock-get-error") - } - _, err := getTenantSecurity(ctx, suite.k8sclient, tenant) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestGetTenantSecurityWithoutError() { - ctx := context.Background() - tenant := &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Name: "mock-tenant", - Namespace: "mock-namespace", - }, - Spec: miniov2.TenantSpec{ - ExternalCaCertSecret: []*miniov2.LocalCertificateReference{}, - }, - } - k8sclientGetSecretMock = func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return nil, errors.New("mock-get-error") - } - sec, err := getTenantSecurity(ctx, suite.k8sclient, tenant) - suite.assert.NotNil(sec) - suite.assert.Nil(err) -} - -func (suite *TenantTestSuite) TestUpdateTenantSecurityHandlerWithError() { - params, api := suite.initUpdateTenantSecurityRequest() - response := api.OperatorAPIUpdateTenantSecurityHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.UpdateTenantSecurityDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) TestUpdateTenantSecurityWrongServerCertificates() { - ctx := context.Background() - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - ExternalCertSecret: []*miniov2.LocalCertificateReference{{ - Name: "mock-crt", - }}, - }, - }, nil - } - params, _ := suite.initUpdateTenantSecurityRequest() - params.Body.CustomCertificates.MinioServerCertificates = []*models.KeyPairConfiguration{{}} - err := updateTenantSecurity(ctx, suite.opClient, suite.k8sclient, "mock-namespace", params) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestUpdateTenantSecurityWrongClientCertificates() { - ctx := context.Background() - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - ExternalClientCertSecrets: []*miniov2.LocalCertificateReference{{ - Name: "mock-crt", - }}, - }, - }, nil - } - params, _ := suite.initUpdateTenantSecurityRequest() - params.Body.CustomCertificates.MinioClientCertificates = []*models.KeyPairConfiguration{{}} - err := updateTenantSecurity(ctx, suite.opClient, suite.k8sclient, "mock-namespace", params) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestUpdateTenantSecurityWrongCACertificates() { - ctx := context.Background() - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - ExternalCaCertSecret: []*miniov2.LocalCertificateReference{{ - Name: "mock-crt", - }}, - }, - }, nil - } - params, _ := suite.initUpdateTenantSecurityRequest() - params.Body.CustomCertificates.MinioCAsCertificates = []string{"mock-ca-certificate"} - err := updateTenantSecurity(ctx, suite.opClient, suite.k8sclient, "mock-namespace", params) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestUpdateTenantSecurityWrongCASecretCertificates() { - ctx := context.Background() - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - ExternalCaCertSecret: []*miniov2.LocalCertificateReference{{ - Name: "mock-crt", - }}, - }, - }, nil - } - k8sClientCreateSecretMock = func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) { - return nil, errors.New("mock-create-error") - } - params, _ := suite.initUpdateTenantSecurityRequest() - params.Body.CustomCertificates.MinioCAsCertificates = []string{"bW9jaw=="} - err := updateTenantSecurity(ctx, suite.opClient, suite.k8sclient, "mock-namespace", params) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestUpdateTenantSecurityWrongSC() { - ctx := context.Background() - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - } - params, _ := suite.initUpdateTenantSecurityRequest() - err := updateTenantSecurity(ctx, suite.opClient, suite.k8sclient, "mock-namespace", params) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestUpdateTenantSecurityWithoutError() { - ctx := context.Background() - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - Pools: []miniov2.Pool{{}}, - }, - }, nil - } - opClientTenantUpdateMock = func(ctx context.Context, tenant *miniov2.Tenant, opts metav1.UpdateOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - } - params, _ := suite.initUpdateTenantSecurityRequest() - params.Body.SecurityContext = suite.createMockModelsSecurityContext() - err := updateTenantSecurity(ctx, suite.opClient, suite.k8sclient, "mock-namespace", params) - suite.assert.Nil(err) -} - -func (suite *TenantTestSuite) initUpdateTenantSecurityRequest() (params operator_api.UpdateTenantSecurityParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - params.Body = &models.UpdateTenantSecurityRequest{ - CustomCertificates: &models.UpdateTenantSecurityRequestCustomCertificates{ - SecretsToBeDeleted: []string{"mock-certificate"}, - }, - } - - return params, api -} - -func (suite *TenantTestSuite) TestSetTenantAdministratorsHandlerWithError() { - params, api := suite.initSetTenantAdministratorsRequest() - response := api.OperatorAPISetTenantAdministratorsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.SetTenantAdministratorsDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) TestSetTenantAdministratorsWithAdminClientError() { - params, _ := suite.initSetTenantAdministratorsRequest() - tenant := &miniov2.Tenant{} - err := setTenantAdministrators(context.Background(), tenant, suite.k8sclient, params) - suite.assert.NotNil(err) -} - -// TODO: Mock minio adminclient -func (suite *TenantTestSuite) TestSetTenantAdministratorsWithUserPolicyError() { - params, _ := suite.initSetTenantAdministratorsRequest() - tenant := &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - Env: []corev1.EnvVar{ - {Name: "accesskey", Value: "mock-access"}, - {Name: "secretkey", Value: "mock-secret"}, - }, - }, - } - params.Body.UserDNS = []string{"mock-user"} - err := setTenantAdministrators(context.Background(), tenant, suite.k8sclient, params) - suite.assert.NotNil(err) -} - -// TODO: Mock minio adminclient -func (suite *TenantTestSuite) TestSetTenantAdministratorsWithGroupPolicyError() { - params, _ := suite.initSetTenantAdministratorsRequest() - tenant := &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - Env: []corev1.EnvVar{ - {Name: "accesskey", Value: "mock-access"}, - {Name: "secretkey", Value: "mock-secret"}, - }, - }, - } - params.Body.GroupDNS = []string{"mock-user"} - err := setTenantAdministrators(context.Background(), tenant, suite.k8sclient, params) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestSetTenantAdministratorsWithoutError() { - params, _ := suite.initSetTenantAdministratorsRequest() - tenant := &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - Env: []corev1.EnvVar{ - {Name: "accesskey", Value: "mock-access"}, - {Name: "secretkey", Value: "mock-secret"}, - }, - }, - } - err := setTenantAdministrators(context.Background(), tenant, suite.k8sclient, params) - suite.assert.Nil(err) -} - -func (suite *TenantTestSuite) initSetTenantAdministratorsRequest() (params operator_api.SetTenantAdministratorsParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - params.Body = &models.SetAdministratorsRequest{} - return params, api -} - -func (suite *TenantTestSuite) TestTenantIdentityProviderHandlerWithError() { - params, api := suite.initTenantIdentityProviderRequest() - response := api.OperatorAPITenantIdentityProviderHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.TenantIdentityProviderDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initTenantIdentityProviderRequest() (params operator_api.TenantIdentityProviderParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - return params, api -} - -func (suite *TenantTestSuite) TestGetTenantIdentityProviderWithIDPConfig() { - ctx := context.Background() - tenant := &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Name: "mock-tenant", - Namespace: "mock-namespace", - }, - Spec: miniov2.TenantSpec{ - Env: []corev1.EnvVar{ - {Name: "MINIO_IDENTITY_OPENID_CONFIG_URL", Value: "mock"}, - {Name: "MINIO_IDENTITY_OPENID_REDIRECT_URI", Value: "mock"}, - {Name: "MINIO_IDENTITY_OPENID_CLAIM_NAME", Value: "mock"}, - {Name: "MINIO_IDENTITY_OPENID_CLIENT_ID", Value: "mock"}, - {Name: "MINIO_IDENTITY_OPENID_CLIENT_SECRET", Value: "mock"}, - }, - }, - } - res, err := getTenantIdentityProvider(ctx, suite.k8sclient, tenant) - suite.assert.NotNil(res) - suite.assert.NotNil(res.Oidc) - suite.assert.Nil(err) -} - -func (suite *TenantTestSuite) TestGetTenantIdentityProviderWithLDAPConfig() { - ctx := context.Background() - tenant := &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Name: "mock-tenant", - Namespace: "mock-namespace", - }, - Spec: miniov2.TenantSpec{ - Env: []corev1.EnvVar{ - {Name: "MINIO_IDENTITY_LDAP_GROUP_SEARCH_BASE_DN", Value: "mock"}, - {Name: "MINIO_IDENTITY_LDAP_GROUP_SEARCH_FILTER", Value: "mock"}, - {Name: "MINIO_IDENTITY_LDAP_LOOKUP_BIND_DN", Value: "mock"}, - {Name: "MINIO_IDENTITY_LDAP_LOOKUP_BIND_PASSWORD", Value: "mock"}, - {Name: "MINIO_IDENTITY_LDAP_SERVER_INSECURE", Value: "mock"}, - {Name: "MINIO_IDENTITY_LDAP_SERVER_STARTTLS", Value: "mock"}, - {Name: "MINIO_IDENTITY_LDAP_TLS_SKIP_VERIFY", Value: "mock"}, - {Name: "MINIO_IDENTITY_LDAP_SERVER_ADDR", Value: "mock"}, - {Name: "MINIO_IDENTITY_LDAP_USER_DN_SEARCH_BASE_DN", Value: "mock"}, - {Name: "MINIO_IDENTITY_LDAP_USER_DN_SEARCH_FILTER", Value: "mock"}, - }, - }, - } - res, err := getTenantIdentityProvider(ctx, suite.k8sclient, tenant) - suite.assert.NotNil(res) - suite.assert.NotNil(res.ActiveDirectory) - suite.assert.Nil(err) -} - -func (suite *TenantTestSuite) TestUpdateTenantIdentityProviderHandlerWithError() { - params, api := suite.initUpdateTenantIdentityProviderRequest() - response := api.OperatorAPIUpdateTenantIdentityProviderHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.UpdateTenantIdentityProviderDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initUpdateTenantIdentityProviderRequest() (params operator_api.UpdateTenantIdentityProviderParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - params.Body = &models.IdpConfiguration{} - return params, api -} - -func (suite *TenantTestSuite) TestUpdateTenantIdentityProviderWithTenantError() { - ctx := context.Background() - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return nil, errors.New("mock") - } - params, _ := suite.initUpdateTenantIdentityProviderRequest() - err := updateTenantIdentityProvider(ctx, suite.opClient, suite.k8sclient, "mock-namespace", params) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestUpdateTenantIdentityProviderWithTenantConfigurationError() { - ctx := context.Background() - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - CredsSecret: &corev1.LocalObjectReference{ - Name: "mock", - }, - }, - }, nil - } - k8sclientGetSecretMock = func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return nil, errors.New("mock-get-error") - } - params, _ := suite.initUpdateTenantIdentityProviderRequest() - err := updateTenantIdentityProvider(ctx, suite.opClient, suite.k8sclient, "mock-namespace", params) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestUpdateTenantIdentityProviderWithSecretCreationError() { - ctx := context.Background() - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - Env: []corev1.EnvVar{ - {Name: "mock", Value: "mock"}, - }, - }, - }, nil - } - k8sClientCreateSecretMock = func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) { - return nil, errors.New("mock-create-error") - } - params, _ := suite.initUpdateTenantIdentityProviderRequest() - err := updateTenantIdentityProvider(ctx, suite.opClient, suite.k8sclient, "mock-namespace", params) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestUpdateTenantIdentityProviderWithoutError() { - ctx := context.Background() - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - } - opClientTenantUpdateMock = func(ctx context.Context, tenant *miniov2.Tenant, opts metav1.UpdateOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - } - k8sClientCreateSecretMock = func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) { - return nil, nil - } - params, _ := suite.initUpdateTenantIdentityProviderRequest() - params.Body.ActiveDirectory = &models.IdpConfigurationActiveDirectory{} - configURL := "mock" - clientID := "mock" - clientSecret := "mock" - claimName := "mock" - params.Body.Oidc = &models.IdpConfigurationOidc{ - ConfigurationURL: &configURL, - ClientID: &clientID, - SecretID: &clientSecret, - ClaimName: &claimName, - } - params.Body.ActiveDirectory = &models.IdpConfigurationActiveDirectory{ - URL: &configURL, - LookupBindDn: &claimName, - SkipTLSVerification: true, - ServerInsecure: true, - ServerStartTLS: true, - } - err := updateTenantIdentityProvider(ctx, suite.opClient, suite.k8sclient, "mock-namespace", params) - suite.assert.Nil(err) -} - -func (suite *TenantTestSuite) TestDeleteTenantHandlerWithError() { - params, api := suite.initDeleteTenantRequest() - response := api.OperatorAPIDeleteTenantHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.DeleteTenantDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initDeleteTenantRequest() (params operator_api.DeleteTenantParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - return params, api -} - -func (suite *TenantTestSuite) TestDeletePodHandlerWithoutError() { - params, api := suite.initDeletePodRequest() - response := api.OperatorAPIDeletePodHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.DeletePodDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initDeletePodRequest() (params operator_api.DeletePodParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - params.PodName = "mock-tenantmock-pod" - return params, api -} - -func (suite *TenantTestSuite) TestUpdateTenantHandlerWithError() { - params, api := suite.initUpdateTenantRequest() - response := api.OperatorAPIUpdateTenantHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.UpdateTenantDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initUpdateTenantRequest() (params operator_api.UpdateTenantParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - params.Body = &models.UpdateTenantRequest{ - Image: "mock-image", - } - return params, api -} - -func (suite *TenantTestSuite) TestTenantAddPoolHandlerWithError() { - params, api := suite.initTenantAddPoolRequest() - response := api.OperatorAPITenantAddPoolHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.TenantAddPoolDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initTenantAddPoolRequest() (params operator_api.TenantAddPoolParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - return params, api -} - -func (suite *TenantTestSuite) TestGetTenantUsageHandlerWithError() { - params, api := suite.initGetTenantUsageRequest() - response := api.OperatorAPIGetTenantUsageHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.GetTenantUsageDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initGetTenantUsageRequest() (params operator_api.GetTenantUsageParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - return params, api -} - -func (suite *TenantTestSuite) TestGetTenantUsageWithWrongAdminClient() { - tenant := &miniov2.Tenant{} - usage, err := getTenantUsage(context.Background(), tenant, suite.k8sclient) - suite.assert.Nil(usage) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestGetTenantUsageWithError() { - restapi.MinioServerInfoMock = func(ctx context.Context) (madmin.InfoMessage, error) { - return madmin.InfoMessage{}, errors.New("mock-server-info-error") - } - usage, err := _getTenantUsage(context.Background(), suite.adminClient) - suite.assert.Nil(usage) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestGetTenantUsageWithNoError() { - restapi.MinioServerInfoMock = func(ctx context.Context) (madmin.InfoMessage, error) { - return madmin.InfoMessage{}, nil - } - usage, err := _getTenantUsage(context.Background(), suite.adminClient) - suite.assert.NotNil(usage) - suite.assert.Nil(err) -} - -func (suite *TenantTestSuite) TestGetTenantPodsHandlerWithError() { - params, api := suite.initGetTenantPodsRequest() - response := api.OperatorAPIGetTenantPodsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.GetTenantPodsDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initGetTenantPodsRequest() (params operator_api.GetTenantPodsParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - return params, api -} - -func (suite *TenantTestSuite) TestGetTenantPodsWithoutError() { - pods := getTenantPods(&corev1.PodList{ - Items: []corev1.Pod{ - { - Status: corev1.PodStatus{ - ContainerStatuses: []corev1.ContainerStatus{{}}, - }, - ObjectMeta: metav1.ObjectMeta{ - DeletionTimestamp: &metav1.Time{Time: time.Now()}, - }, - }, - }, - }) - suite.assert.Equal(1, len(pods)) -} - -func (suite *TenantTestSuite) TestGetPodLogsHandlerWithError() { - params, api := suite.initGetPodLogsRequest() - response := api.OperatorAPIGetPodLogsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.GetPodLogsDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initGetPodLogsRequest() (params operator_api.GetPodLogsParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - params.PodName = "mokc-pod" - return params, api -} - -func (suite *TenantTestSuite) TestGetPodEventsHandlerWithError() { - params, api := suite.initGetPodEventsRequest() - response := api.OperatorAPIGetPodEventsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.GetPodEventsDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initGetPodEventsRequest() (params operator_api.GetPodEventsParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - params.PodName = "mock-pod" - return params, api -} - -func (suite *TenantTestSuite) TestDescribePodHandlerWithError() { - params, api := suite.initDescribePodRequest() - response := api.OperatorAPIDescribePodHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.DescribePodDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initDescribePodRequest() (params operator_api.DescribePodParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - params.PodName = "mock-pod" - return params, api -} - -func (suite *TenantTestSuite) TestGetTenantMonitoringHandlerWithError() { - params, api := suite.initGetTenantMonitoringRequest() - response := api.OperatorAPIGetTenantMonitoringHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.GetTenantMonitoringDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initGetTenantMonitoringRequest() (params operator_api.GetTenantMonitoringParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - return params, api -} - -func (suite *TenantTestSuite) TestGetTenantMonitoringWithoutPrometheus() { - tenant := &miniov2.Tenant{} - monitoring := getTenantMonitoring(tenant) - suite.assert.False(monitoring.PrometheusEnabled) -} - -func (suite *TenantTestSuite) TestGetTenantMonitoringWithPrometheus() { - stn := "mock-storage-class" - dc := 10 - tenant := &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - Prometheus: &miniov2.PrometheusConfig{ - StorageClassName: &stn, - Resources: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - corev1.ResourceCPU: resource.MustParse("1"), - corev1.ResourceMemory: resource.MustParse("1Gi"), - }, - }, - Labels: map[string]string{ - "mock-label": "mock-value", - }, - Annotations: map[string]string{ - "mock-label": "mock-value", - }, - NodeSelector: map[string]string{ - "mock-label": "mock-value", - }, - DiskCapacityDB: &dc, - Image: "mock-image", - InitImage: "mock-init-image", - ServiceAccountName: "mock-service-account-name", - SideCarImage: "mock-sidecar-image", - SecurityContext: suite.createTenantPodSecurityContext(), - }, - }, - } - monitoring := getTenantMonitoring(tenant) - suite.assert.True(monitoring.PrometheusEnabled) -} - -func (suite *TenantTestSuite) TestSetTenantMonitoringHandlerWithError() { - params, api := suite.initSetTenantMonitoringRequest() - response := api.OperatorAPISetTenantMonitoringHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.SetTenantMonitoringDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) TestSetTenantMonitoringWithTogglePrometheusError() { - opClientTenantUpdateMock = func(ctx context.Context, tenant *miniov2.Tenant, opts metav1.UpdateOptions) (*miniov2.Tenant, error) { - return nil, errors.New("mock-tenant-update-error") - } - params, _ := suite.initSetTenantMonitoringRequest() - params.Data = &models.TenantMonitoringInfo{ - Toggle: true, - } - tenant := &miniov2.Tenant{} - ok, err := setTenantMonitoring(context.Background(), tenant, suite.opClient, params) - suite.assert.False(ok) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestSetTenantMonitoringWithTogglePrometheusNoError() { - opClientTenantUpdateMock = func(ctx context.Context, tenant *miniov2.Tenant, opts metav1.UpdateOptions) (*miniov2.Tenant, error) { - return nil, nil - } - params, _ := suite.initSetTenantMonitoringRequest() - params.Data = &models.TenantMonitoringInfo{ - Toggle: true, - } - tenant := &miniov2.Tenant{} - ok, err := setTenantMonitoring(context.Background(), tenant, suite.opClient, params) - suite.assert.True(ok) - suite.assert.Nil(err) -} - -func (suite *TenantTestSuite) TestSetTenantMonitoringWithTenantUpdateError() { - opClientTenantUpdateMock = func(ctx context.Context, tenant *miniov2.Tenant, opts metav1.UpdateOptions) (*miniov2.Tenant, error) { - return nil, errors.New("mock-tenant-update-error") - } - params, _ := suite.initSetTenantMonitoringRequest() - params.Data = &models.TenantMonitoringInfo{ - Labels: []*models.Label{{ - Key: "mock-label", - Value: "mock-value", - }}, - Annotations: []*models.Annotation{{ - Key: "mock-annotation", - Value: "mock-value", - }}, - NodeSelector: []*models.NodeSelector{{ - Key: "mock-annotation", - Value: "mock-value", - }}, - MonitoringCPURequest: "1", - MonitoringMemRequest: "1Gi", - DiskCapacityGB: "1Gi", - SecurityContext: suite.createMockModelsSecurityContext(), - } - tenant := &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - Prometheus: &miniov2.PrometheusConfig{}, - }, - } - ok, err := setTenantMonitoring(context.Background(), tenant, suite.opClient, params) - suite.assert.False(ok) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestSetTenantMonitoringWithoutError() { - opClientTenantUpdateMock = func(ctx context.Context, tenant *miniov2.Tenant, opts metav1.UpdateOptions) (*miniov2.Tenant, error) { - return nil, nil - } - params, _ := suite.initSetTenantMonitoringRequest() - params.Data = &models.TenantMonitoringInfo{ - SecurityContext: suite.createMockModelsSecurityContext(), - } - tenant := &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - Prometheus: &miniov2.PrometheusConfig{}, - }, - } - ok, err := setTenantMonitoring(context.Background(), tenant, suite.opClient, params) - suite.assert.True(ok) - suite.assert.Nil(err) -} - -func (suite *TenantTestSuite) initSetTenantMonitoringRequest() (params operator_api.SetTenantMonitoringParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - return params, api -} - -func (suite *TenantTestSuite) TestTenantUpdatePoolsHandlerWithError() { - params, api := suite.initTenantUpdatePoolsRequest() - response := api.OperatorAPITenantUpdatePoolsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.TenantUpdatePoolsDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initTenantUpdatePoolsRequest() (params operator_api.TenantUpdatePoolsParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - params.Body = &models.PoolUpdateRequest{ - Pools: []*models.Pool{}, - } - return params, api -} - -func (suite *TenantTestSuite) TestUpdateTenantPoolsWithPoolError() { - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - } - _, err := updateTenantPools(context.Background(), suite.opClient, "mock-namespace", "mock-tenant", []*models.Pool{{}}) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestUpdateTenantPoolsWithPatchError() { - size := int64(1024) - seconds := int64(5) - weight := int32(1024) - servers := int64(4) - volumes := int32(4) - mockString := "mock-string" - pools := []*models.Pool{{ - VolumeConfiguration: &models.PoolVolumeConfiguration{ - Size: &size, - }, - Servers: &servers, - VolumesPerServer: &volumes, - Resources: &models.PoolResources{ - Requests: map[string]int64{ - "cpu": 1, - }, - Limits: map[string]int64{ - "memory": 1, - }, - }, - Tolerations: models.PoolTolerations{{ - TolerationSeconds: &models.PoolTolerationSeconds{ - Seconds: &seconds, - }, - }}, - Affinity: &models.PoolAffinity{ - NodeAffinity: &models.PoolAffinityNodeAffinity{ - RequiredDuringSchedulingIgnoredDuringExecution: &models.PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution{ - NodeSelectorTerms: []*models.NodeSelectorTerm{{ - MatchExpressions: []*models.NodeSelectorTermMatchExpressionsItems0{{ - Key: &mockString, - Operator: &mockString, - }}, - }}, - }, - PreferredDuringSchedulingIgnoredDuringExecution: []*models.PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0{{ - Weight: &weight, - Preference: &models.NodeSelectorTerm{ - MatchFields: []*models.NodeSelectorTermMatchFieldsItems0{{ - Key: &mockString, - Operator: &mockString, - }}, - }, - }}, - }, - PodAffinity: &models.PoolAffinityPodAffinity{ - RequiredDuringSchedulingIgnoredDuringExecution: []*models.PodAffinityTerm{{ - LabelSelector: &models.PodAffinityTermLabelSelector{ - MatchExpressions: []*models.PodAffinityTermLabelSelectorMatchExpressionsItems0{{ - Key: &mockString, - Operator: &mockString, - }}, - }, - TopologyKey: &mockString, - }}, - PreferredDuringSchedulingIgnoredDuringExecution: []*models.PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0{{ - PodAffinityTerm: &models.PodAffinityTerm{ - LabelSelector: &models.PodAffinityTermLabelSelector{ - MatchExpressions: []*models.PodAffinityTermLabelSelectorMatchExpressionsItems0{{ - Key: &mockString, - Operator: &mockString, - }}, - }, - TopologyKey: &mockString, - }, - Weight: &weight, - }}, - }, - PodAntiAffinity: &models.PoolAffinityPodAntiAffinity{ - RequiredDuringSchedulingIgnoredDuringExecution: []*models.PodAffinityTerm{{ - LabelSelector: &models.PodAffinityTermLabelSelector{ - MatchExpressions: []*models.PodAffinityTermLabelSelectorMatchExpressionsItems0{{ - Key: &mockString, - Operator: &mockString, - }}, - }, - TopologyKey: &mockString, - }}, - PreferredDuringSchedulingIgnoredDuringExecution: []*models.PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0{{ - PodAffinityTerm: &models.PodAffinityTerm{ - LabelSelector: &models.PodAffinityTermLabelSelector{ - MatchExpressions: []*models.PodAffinityTermLabelSelectorMatchExpressionsItems0{{ - Key: &mockString, - Operator: &mockString, - }}, - }, - TopologyKey: &mockString, - }, - Weight: &weight, - }}, - }, - }, - }} - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - } - opClientTenantPatchMock = func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) { - return nil, errors.New("mock-patch-error") - } - _, err := updateTenantPools(context.Background(), suite.opClient, "mock-namespace", "mock-tenant", pools) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestUpdateTenantPoolsWithoutError() { - seconds := int64(10) - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - } - opClientTenantPatchMock = func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - Pools: []miniov2.Pool{{ - VolumeClaimTemplate: &corev1.PersistentVolumeClaim{ - Spec: corev1.PersistentVolumeClaimSpec{ - Resources: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - corev1.ResourceStorage: resource.MustParse("1Gi"), - }, - }, - }, - }, - SecurityContext: suite.createTenantPodSecurityContext(), - Tolerations: []corev1.Toleration{{ - TolerationSeconds: &seconds, - }}, - Resources: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - corev1.ResourceCPU: resource.MustParse("1"), - corev1.ResourceMemory: resource.MustParse("1Gi"), - }, - Limits: corev1.ResourceList{ - corev1.ResourceLimitsMemory: resource.MustParse("1"), - }, - }, - Affinity: &corev1.Affinity{ - NodeAffinity: &corev1.NodeAffinity{ - RequiredDuringSchedulingIgnoredDuringExecution: &corev1.NodeSelector{ - NodeSelectorTerms: []corev1.NodeSelectorTerm{{ - MatchExpressions: []corev1.NodeSelectorRequirement{{}}, - }}, - }, - PreferredDuringSchedulingIgnoredDuringExecution: []corev1.PreferredSchedulingTerm{{ - Preference: corev1.NodeSelectorTerm{ - MatchFields: []corev1.NodeSelectorRequirement{{}}, - }, - }}, - }, - PodAffinity: &corev1.PodAffinity{ - RequiredDuringSchedulingIgnoredDuringExecution: []corev1.PodAffinityTerm{{ - LabelSelector: &metav1.LabelSelector{ - MatchExpressions: []metav1.LabelSelectorRequirement{{}}, - }, - }}, - PreferredDuringSchedulingIgnoredDuringExecution: []corev1.WeightedPodAffinityTerm{{ - PodAffinityTerm: corev1.PodAffinityTerm{ - LabelSelector: &metav1.LabelSelector{ - MatchExpressions: []metav1.LabelSelectorRequirement{{}}, - }, - }, - }}, - }, - PodAntiAffinity: &corev1.PodAntiAffinity{ - RequiredDuringSchedulingIgnoredDuringExecution: []corev1.PodAffinityTerm{{ - LabelSelector: &metav1.LabelSelector{ - MatchExpressions: []metav1.LabelSelectorRequirement{{}}, - }, - }}, - PreferredDuringSchedulingIgnoredDuringExecution: []corev1.WeightedPodAffinityTerm{{ - PodAffinityTerm: corev1.PodAffinityTerm{ - LabelSelector: &metav1.LabelSelector{ - MatchExpressions: []metav1.LabelSelectorRequirement{{}}, - }, - }, - }}, - }, - }, - }}, - }, - }, nil - } - _, err := updateTenantPools(context.Background(), suite.opClient, "mock-namespace", "mock-tenant", []*models.Pool{}) - suite.assert.Nil(err) -} - -func (suite *TenantTestSuite) TestTenantUpdateCertificateHandlerWithError() { - params, api := suite.initTenantUpdateCertificateRequest() - response := api.OperatorAPITenantUpdateCertificateHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.TenantUpdateCertificateDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initTenantUpdateCertificateRequest() (params operator_api.TenantUpdateCertificateParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - return params, api -} - -func (suite *TenantTestSuite) TestTenantUpdateEncryptionHandlerWithError() { - params, api := suite.initTenantUpdateEncryptionRequest() - response := api.OperatorAPITenantUpdateEncryptionHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.TenantUpdateEncryptionDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) TestTenantUpdateEncryptionWithExternalCertError() { - params, _ := suite.initTenantUpdateEncryptionRequest() - params.Body = &models.EncryptionConfiguration{ - ServerTLS: &models.KeyPairConfiguration{}, - } - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - KES: &miniov2.KESConfig{ - ExternalCertSecret: &miniov2.LocalCertificateReference{ - Name: "mock-crt", - }, - }, - }, - }, nil - } - err := tenantUpdateEncryption(context.Background(), suite.opClient, suite.k8sclient, params.Namespace, params) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestTenantUpdateEncryptionWithExternalClientCertError() { - params, _ := suite.initTenantUpdateEncryptionRequest() - params.Body = &models.EncryptionConfiguration{ - MinioMtls: &models.KeyPairConfiguration{}, - } - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - ExternalClientCertSecret: &miniov2.LocalCertificateReference{ - Name: "mock-crt", - }, - }, - }, nil - } - err := tenantUpdateEncryption(context.Background(), suite.opClient, suite.k8sclient, params.Namespace, params) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestTenantUpdateEncryptionAWSWithoutError() { - params, _ := suite.initTenantUpdateEncryptionRequest() - endpoint := "mock-endpoint" - region := "mock-region" - ak := "mock-accesskey" - sk := "mock-secretkey" - params.Body = &models.EncryptionConfiguration{ - Replicas: "1", - SecurityContext: suite.createMockModelsSecurityContext(), - SecretsToBeDeleted: []string{"mock-crt"}, - Aws: &models.AwsConfiguration{ - Secretsmanager: &models.AwsConfigurationSecretsmanager{ - Endpoint: &endpoint, - Region: ®ion, - Kmskey: "mock-kmskey", - Credentials: &models.AwsConfigurationSecretsmanagerCredentials{ - Accesskey: &ak, - Secretkey: &sk, - }, - }, - }, - } - k8sClientCreateSecretMock = func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) { - return nil, nil - } - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - ExternalClientCertSecret: &miniov2.LocalCertificateReference{ - Name: "mock-crt", - }, - KES: &miniov2.KESConfig{ - ExternalCertSecret: &miniov2.LocalCertificateReference{ - Name: "mock-crt", - }, - }, - }, - }, nil - } - opClientTenantUpdateMock = func(ctx context.Context, tenant *miniov2.Tenant, opts metav1.UpdateOptions) (*miniov2.Tenant, error) { - return nil, nil - } - err := tenantUpdateEncryption(context.Background(), suite.opClient, suite.k8sclient, params.Namespace, params) - suite.assert.Nil(err) -} - -func (suite *TenantTestSuite) TestTenantUpdateEncryptionGemaltoWithoutError() { - params, _ := suite.initTenantUpdateEncryptionRequest() - endpoint := "mock-endpoint" - token := "mock-token" - domain := "mock-domain" - params.Body = &models.EncryptionConfiguration{ - Replicas: "1", - SecurityContext: suite.createMockModelsSecurityContext(), - Gemalto: &models.GemaltoConfiguration{ - Keysecure: &models.GemaltoConfigurationKeysecure{ - Endpoint: &endpoint, - Credentials: &models.GemaltoConfigurationKeysecureCredentials{ - Token: &token, - Domain: &domain, - }, - }, - }, - KmsMtls: &models.EncryptionConfigurationAO1KmsMtls{ - Ca: "bW9jaw==", - }, - } - suite.prepareEncryptionUpdateMocksNoError() - err := tenantUpdateEncryption(context.Background(), suite.opClient, suite.k8sclient, params.Namespace, params) - suite.assert.Nil(err) -} - -func (suite *TenantTestSuite) TestTenantUpdateEncryptionGCPWithoutError() { - params, _ := suite.initTenantUpdateEncryptionRequest() - project := "mock-project" - params.Body = &models.EncryptionConfiguration{ - Replicas: "1", - SecurityContext: suite.createMockModelsSecurityContext(), - Gcp: &models.GcpConfiguration{ - Secretmanager: &models.GcpConfigurationSecretmanager{ - ProjectID: &project, - Endpoint: "mock-endpoint", - Credentials: &models.GcpConfigurationSecretmanagerCredentials{ - ClientEmail: "mock", - ClientID: "mock", - PrivateKey: "mock", - PrivateKeyID: "mock", - }, - }, - }, - } - suite.prepareEncryptionUpdateMocksNoError() - err := tenantUpdateEncryption(context.Background(), suite.opClient, suite.k8sclient, params.Namespace, params) - suite.assert.Nil(err) -} - -func (suite *TenantTestSuite) TestTenantUpdateEncryptionAzureWithoutError() { - params, _ := suite.initTenantUpdateEncryptionRequest() - endpoint := "mock-endpoint" - tenant := "mock-tenant" - clientID := "mock-client-id" - clientSecret := "mock-client-secret" - params.Body = &models.EncryptionConfiguration{ - Replicas: "1", - SecurityContext: suite.createMockModelsSecurityContext(), - Azure: &models.AzureConfiguration{ - Keyvault: &models.AzureConfigurationKeyvault{ - Endpoint: &endpoint, - Credentials: &models.AzureConfigurationKeyvaultCredentials{ - TenantID: &tenant, - ClientID: &clientID, - ClientSecret: &clientSecret, - }, - }, - }, - } - suite.prepareEncryptionUpdateMocksNoError() - err := tenantUpdateEncryption(context.Background(), suite.opClient, suite.k8sclient, params.Namespace, params) - suite.assert.Nil(err) -} - -func (suite *TenantTestSuite) prepareEncryptionUpdateMocksNoError() { - k8sClientCreateSecretMock = func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) { - return nil, nil - } - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{Spec: miniov2.TenantSpec{}}, nil - } - opClientTenantUpdateMock = func(ctx context.Context, tenant *miniov2.Tenant, opts metav1.UpdateOptions) (*miniov2.Tenant, error) { - return nil, nil - } -} - -func (suite *TenantTestSuite) initTenantUpdateEncryptionRequest() (params operator_api.TenantUpdateEncryptionParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - return params, api -} - -func (suite *TenantTestSuite) TestTenantDeleteEncryptionHandlerWithError() { - params, api := suite.initTenantDeleteEncryptionRequest() - response := api.OperatorAPITenantDeleteEncryptionHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.TenantDeleteEncryptionDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initTenantDeleteEncryptionRequest() (params operator_api.TenantDeleteEncryptionParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - return params, api -} - -func (suite *TenantTestSuite) TestTenantEncryptionInfoHandlerWithError() { - params, api := suite.initTenantEncryptionInfoRequest() - response := api.OperatorAPITenantEncryptionInfoHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.TenantEncryptionInfoDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) TestTenantEncryptionInfoWitNoKesError() { - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{Spec: miniov2.TenantSpec{}}, nil - } - params, _ := suite.initTenantEncryptionInfoRequest() - res, err := tenantEncryptionInfo(context.Background(), suite.opClient, suite.k8sclient, params.Namespace, params) - suite.assert.Nil(res) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestTenantEncryptionInfoWithExtCertError() { - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - KES: &miniov2.KESConfig{ - ExternalCertSecret: &miniov2.LocalCertificateReference{ - Name: "mock-crt", - }, - SecurityContext: suite.createTenantPodSecurityContext(), - }, - }, - }, nil - } - k8sclientGetSecretMock = func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return nil, errors.New("mock-get-error") - } - params, _ := suite.initTenantEncryptionInfoRequest() - res, err := tenantEncryptionInfo(context.Background(), suite.opClient, suite.k8sclient, params.Namespace, params) - suite.assert.Nil(res) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestTenantEncryptionInfoWithClientCertError() { - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - KES: &miniov2.KESConfig{}, - ExternalClientCertSecret: &miniov2.LocalCertificateReference{ - Name: "mock-crt", - }, - }, - }, nil - } - k8sclientGetSecretMock = func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return nil, errors.New("mock-get-error") - } - params, _ := suite.initTenantEncryptionInfoRequest() - res, err := tenantEncryptionInfo(context.Background(), suite.opClient, suite.k8sclient, params.Namespace, params) - suite.assert.Nil(res) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestTenantEncryptionInfoWithKesClientCertError() { - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - KES: &miniov2.KESConfig{ - ClientCertSecret: &miniov2.LocalCertificateReference{ - Name: "mock-kes-crt", - }, - Configuration: &corev1.LocalObjectReference{ - Name: "mock-kes-config", - }, - }, - }, - }, nil - } - k8sclientGetSecretMock = func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - if secretName == "mock-kes-config" { - return &corev1.Secret{ - Data: map[string][]byte{ - "server-config.yaml": suite.getKesYamlMock(false), - }, - }, nil - } - if secretName == "mock-kes-crt" { - return &corev1.Secret{ - Data: map[string][]byte{ - "client.crt": []byte("mock-client-crt"), - }, - }, nil - } - return nil, errors.New("mock-get-error") - } - params, _ := suite.initTenantEncryptionInfoRequest() - res, err := tenantEncryptionInfo(context.Background(), suite.opClient, suite.k8sclient, params.Namespace, params) - suite.assert.Nil(res) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestTenantEncryptionInfoWithKesClientCACertError() { - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - KES: &miniov2.KESConfig{ - ClientCertSecret: &miniov2.LocalCertificateReference{ - Name: "mock-kes-crt", - }, - Configuration: &corev1.LocalObjectReference{ - Name: "mock-kes-config", - }, - }, - }, - }, nil - } - k8sclientGetSecretMock = func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - if secretName == "mock-kes-config" { - return &corev1.Secret{ - Data: map[string][]byte{ - "server-config.yaml": suite.getKesYamlMock(false), - }, - }, nil - } - if secretName == "mock-kes-crt" { - return &corev1.Secret{ - Data: map[string][]byte{ - "ca.crt": []byte("mock-client-crt"), - }, - }, nil - } - return nil, errors.New("mock-get-error") - } - params, _ := suite.initTenantEncryptionInfoRequest() - res, err := tenantEncryptionInfo(context.Background(), suite.opClient, suite.k8sclient, params.Namespace, params) - suite.assert.Nil(res) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestTenantEncryptionInfoWithGemaltoError() { - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - KES: &miniov2.KESConfig{ - ClientCertSecret: &miniov2.LocalCertificateReference{ - Name: "mock-kes-crt", - }, - Configuration: &corev1.LocalObjectReference{ - Name: "mock-kes-config", - }, - }, - }, - }, nil - } - k8sclientGetSecretMock = func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - if secretName == "mock-kes-config" { - return &corev1.Secret{ - Data: map[string][]byte{ - "server-config.yaml": suite.getKesYamlMock(true), - }, - }, nil - } - if secretName == "mock-kes-crt" { - return &corev1.Secret{ - Data: map[string][]byte{ - "ca.crt": []byte("mock-client-crt"), - }, - }, nil - } - return nil, errors.New("mock-get-error") - } - params, _ := suite.initTenantEncryptionInfoRequest() - res, err := tenantEncryptionInfo(context.Background(), suite.opClient, suite.k8sclient, params.Namespace, params) - suite.assert.Nil(res) - suite.assert.NotNil(err) -} - -func (suite *TenantTestSuite) TestTenantEncryptionInfoWithoutError() { - opClientTenantGetMock = func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - KES: &miniov2.KESConfig{ - Configuration: &corev1.LocalObjectReference{ - Name: "mock-kes-config", - }, - }, - }, - }, nil - } - k8sclientGetSecretMock = func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - if secretName == "mock-kes-config" { - return &corev1.Secret{ - Data: map[string][]byte{ - "server-config.yaml": suite.getKesYamlMock(false), - }, - }, nil - } - return nil, errors.New("mock-get-error") - } - params, _ := suite.initTenantEncryptionInfoRequest() - res, err := tenantEncryptionInfo(context.Background(), suite.opClient, suite.k8sclient, params.Namespace, params) - suite.assert.NotNil(res) - suite.assert.Nil(err) -} - -func (suite *TenantTestSuite) getKesYamlMock(noVault bool) []byte { - kesConfig := &kes.ServerConfig{ - Keys: kes.Keys{ - Vault: &kes.Vault{ - Prefix: "mock-prefix", - Namespace: "mock-namespace", - EnginePath: "mock-engine-path", - Endpoint: "mock-endpoint", - Status: &kes.VaultStatus{ - Ping: 5 * time.Second, - }, - AppRole: &kes.AppRole{ - EnginePath: "mock-engine-path", - ID: "mock-id", - Retry: 5 * time.Second, - Secret: "mock-secret", - }, - }, - Aws: &kes.Aws{}, - Gcp: &kes.Gcp{}, - Gemalto: &kes.Gemalto{ - KeySecure: &kes.GemaltoKeySecure{ - Endpoint: "mock-endpoint", - Credentials: &kes.GemaltoCredentials{ - Domain: "mock-domain", - Retry: 5 * time.Second, - Token: "mock-token", - }, - TLS: &kes.GemaltoTLS{}, - }, - }, - Azure: &kes.Azure{}, - }, - } - if noVault { - kesConfig.Keys.Vault = nil - } - kesConfigBytes, _ := yaml.Marshal(kesConfig) - return kesConfigBytes -} - -func (suite *TenantTestSuite) initTenantEncryptionInfoRequest() (params operator_api.TenantEncryptionInfoParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - return params, api -} - -func (suite *TenantTestSuite) TestGetTenantYAMLHandlerWithError() { - params, api := suite.initGetTenantYAMLRequest() - response := api.OperatorAPIGetTenantYAMLHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.GetTenantYAMLDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initGetTenantYAMLRequest() (params operator_api.GetTenantYAMLParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - return params, api -} - -func (suite *TenantTestSuite) TestPutTenantYAMLHandlerWithError() { - params, api := suite.initPutTenantYAMLRequest() - response := api.OperatorAPIPutTenantYAMLHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.PutTenantYAMLDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initPutTenantYAMLRequest() (params operator_api.PutTenantYAMLParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - params.Body = &models.TenantYAML{ - Yaml: "", - } - return params, api -} - -func (suite *TenantTestSuite) TestGetTenantEventsHandlerWithError() { - params, api := suite.initGetTenantEventsRequest() - response := api.OperatorAPIGetTenantEventsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.GetTenantEventsDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initGetTenantEventsRequest() (params operator_api.GetTenantEventsParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace" - params.Tenant = "mock-tenant" - return params, api -} - -func (suite *TenantTestSuite) TestUpdateTenantDomainsHandlerWithError() { - params, api := suite.initUpdateTenantDomainsRequest() - response := api.OperatorAPIUpdateTenantDomainsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*operator_api.UpdateTenantDomainsDefault) - suite.assert.True(ok) -} - -func (suite *TenantTestSuite) initUpdateTenantDomainsRequest() (params operator_api.UpdateTenantDomainsParams, api operations.OperatorAPI) { - registerTenantHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Namespace = "mock-namespace-domain" - params.Tenant = "mock-tenant-domain" - params.Body = &models.UpdateDomainsRequest{ - Domains: &models.DomainsConfiguration{}, - } - return params, api -} - -func TestTenant(t *testing.T) { - suite.Run(t, new(TenantTestSuite)) -} - -func (suite *TenantTestSuite) createMockModelsSecurityContext() *models.SecurityContext { - runAsUser := "1000" - runAsGroup := "1000" - fsGroup := "1000" - return &models.SecurityContext{ - RunAsUser: &runAsUser, - RunAsGroup: &runAsGroup, - FsGroup: fsGroup, - } -} - -func (suite *TenantTestSuite) createTenantPodSecurityContext() *corev1.PodSecurityContext { - runAsUser := int64(1000) - runAsGroup := int64(1000) - fsGroup := int64(1000) - fscp := corev1.PodFSGroupChangePolicy("OnRootMismatch") - return &corev1.PodSecurityContext{ - RunAsUser: &runAsUser, - RunAsGroup: &runAsGroup, - FSGroup: &fsGroup, - FSGroupChangePolicy: &fscp, - } -} diff --git a/operatorapi/tenants_helper.go b/operatorapi/tenants_helper.go deleted file mode 100644 index 0eb157025..000000000 --- a/operatorapi/tenants_helper.go +++ /dev/null @@ -1,901 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "crypto" - "crypto/tls" - "encoding/base64" - "encoding/hex" - "encoding/json" - "errors" - "fmt" - "strconv" - "time" - - xerrors "github.com/minio/console/restapi" - - "github.com/minio/console/operatorapi/operations/operator_api" - - "github.com/minio/console/cluster" - "github.com/minio/console/models" - "github.com/minio/console/pkg/kes" - miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - "gopkg.in/yaml.v2" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// convertModelSCToK8sSC validates and converts from models.SecurityContext to corev1.PodSecurityContext -func convertModelSCToK8sSC(sc *models.SecurityContext) (*corev1.PodSecurityContext, error) { - if sc == nil { - return nil, errors.New("invalid security context") - } - runAsUser, err := strconv.ParseInt(*sc.RunAsUser, 10, 64) - if err != nil { - return nil, err - } - runAsGroup, err := strconv.ParseInt(*sc.RunAsGroup, 10, 64) - if err != nil { - return nil, err - } - fsGroup, err := strconv.ParseInt(sc.FsGroup, 10, 64) - if err != nil { - return nil, err - } - FSGroupChangePolicy := corev1.PodFSGroupChangePolicy("Always") - if sc.FsGroupChangePolicy != "" { - FSGroupChangePolicy = corev1.PodFSGroupChangePolicy(sc.FsGroupChangePolicy) - } - return &corev1.PodSecurityContext{ - RunAsUser: &runAsUser, - RunAsGroup: &runAsGroup, - RunAsNonRoot: sc.RunAsNonRoot, - FSGroup: &fsGroup, - FSGroupChangePolicy: &FSGroupChangePolicy, - }, nil -} - -// convertK8sSCToModelSC validates and converts from corev1.PodSecurityContext to models.SecurityContext -func convertK8sSCToModelSC(sc *corev1.PodSecurityContext) *models.SecurityContext { - runAsUser := strconv.FormatInt(*sc.RunAsUser, 10) - runAsGroup := strconv.FormatInt(*sc.RunAsGroup, 10) - fsGroup := strconv.FormatInt(*sc.FSGroup, 10) - fsGroupChangePolicy := "Always" - - if sc.FSGroupChangePolicy != nil { - fsGroupChangePolicy = string(*sc.FSGroupChangePolicy) - } - - return &models.SecurityContext{ - RunAsUser: &runAsUser, - RunAsGroup: &runAsGroup, - RunAsNonRoot: sc.RunAsNonRoot, - FsGroup: fsGroup, - FsGroupChangePolicy: fsGroupChangePolicy, - } -} - -// tenantUpdateCertificates receives the keyPair certificates (public and private keys) for Minio and Console and will try -// to replace the existing kubernetes secrets with the new values, then will restart the affected pods so the new volumes can be mounted -func tenantUpdateCertificates(ctx context.Context, operatorClient OperatorClientI, clientSet K8sClientI, namespace string, params operator_api.TenantUpdateCertificateParams) error { - tenantName := params.Tenant - tenant, err := operatorClient.TenantGet(ctx, namespace, tenantName, metav1.GetOptions{}) - if err != nil { - return err - } - body := params.Body - // check if MinIO is deployed with external certs and user provided new MinIO keypair - if tenant.ExternalCert() && body.MinioServerCertificates != nil { - minioCertSecretName := fmt.Sprintf("%s-instance-external-certificates", tenantName) - // update certificates - if _, err := createOrReplaceExternalCertSecrets(ctx, clientSet, namespace, body.MinioServerCertificates, minioCertSecretName, tenantName); err != nil { - return err - } - } - return nil -} - -// getTenantUpdateCertificatesResponse wrapper of tenantUpdateCertificates -func getTenantUpdateCertificatesResponse(session *models.Principal, params operator_api.TenantUpdateCertificateParams) *models.Error { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - // get Kubernetes Client - clientSet, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return xerrors.ErrorWithContext(ctx, err, xerrors.ErrUnableToUpdateTenantCertificates) - } - k8sClient := k8sClient{ - client: clientSet, - } - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return xerrors.ErrorWithContext(ctx, err, xerrors.ErrUnableToUpdateTenantCertificates) - } - opClient := operatorClient{ - client: opClientClientSet, - } - if err := tenantUpdateCertificates(ctx, &opClient, &k8sClient, params.Namespace, params); err != nil { - return xerrors.ErrorWithContext(ctx, err, xerrors.ErrUnableToUpdateTenantCertificates) - } - return nil -} - -// tenantDeleteEncryption allow user to disable tenant encryption for a particular tenant -func tenantDeleteEncryption(ctx context.Context, operatorClient OperatorClientI, namespace string, params operator_api.TenantDeleteEncryptionParams) error { - tenantName := params.Tenant - tenant, err := operatorClient.TenantGet(ctx, namespace, tenantName, metav1.GetOptions{}) - if err != nil { - return err - } - tenant.EnsureDefaults() - tenant.Spec.KES = nil - _, err = operatorClient.TenantUpdate(ctx, tenant, metav1.UpdateOptions{}) - if err != nil { - return err - } - return nil -} - -// tenantUpdateEncryption allow user to update KES server certificates, KES client certificates (used by MinIO for mTLS) and KES configuration (KMS configuration, credentials, etc) -func tenantUpdateEncryption(ctx context.Context, operatorClient OperatorClientI, clientSet K8sClientI, namespace string, params operator_api.TenantUpdateEncryptionParams) error { - tenantName := params.Tenant - secretName := fmt.Sprintf("%s-secret", tenantName) - tenant, err := operatorClient.TenantGet(ctx, namespace, tenantName, metav1.GetOptions{}) - body := params.Body - if err != nil { - return err - } - tenant.EnsureDefaults() - // Initialize KES configuration if not present - if !tenant.HasKESEnabled() { - tenant.Spec.KES = &miniov2.KESConfig{} - } - if tenant.KESExternalCert() { - for _, certificateToBeDeleted := range params.Body.SecretsToBeDeleted { - if tenant.Spec.KES.ExternalCertSecret.Name == certificateToBeDeleted { - tenant.Spec.KES.ExternalCertSecret = nil - break - } - } - } - if tenant.ExternalClientCert() { - for _, certificateToBeDeleted := range params.Body.SecretsToBeDeleted { - if tenant.Spec.ExternalClientCertSecret.Name == certificateToBeDeleted { - tenant.Spec.ExternalClientCertSecret = nil - break - } - } - } - if body.ServerTLS != nil { - kesExternalCertSecretName := fmt.Sprintf("%s-kes-external-cert", secretName) - if tenant.KESExternalCert() { - kesExternalCertSecretName = tenant.Spec.KES.ExternalCertSecret.Name - } - // update certificates - certificates := []*models.KeyPairConfiguration{body.ServerTLS} - createdCertificates, err := createOrReplaceExternalCertSecrets(ctx, clientSet, namespace, certificates, kesExternalCertSecretName, tenantName) - if err != nil { - return err - } - if len(createdCertificates) > 0 { - tenant.Spec.KES.ExternalCertSecret = createdCertificates[0] - } - } - if body.MinioMtls != nil { - tenantExternalClientCertSecretName := fmt.Sprintf("%s-tenant-external-client-cert", secretName) - if tenant.ExternalClientCert() { - tenantExternalClientCertSecretName = tenant.Spec.ExternalClientCertSecret.Name - } - // Update certificates - certificates := []*models.KeyPairConfiguration{body.MinioMtls} - createdCertificates, err := createOrReplaceExternalCertSecrets(ctx, clientSet, namespace, certificates, tenantExternalClientCertSecretName, tenantName) - if err != nil { - return err - } - if len(createdCertificates) > 0 { - tenant.Spec.ExternalClientCertSecret = createdCertificates[0] - } - } - // update KES identities in kes-configuration.yaml secret - kesConfigurationSecretName := fmt.Sprintf("%s-kes-configuration", secretName) - kesClientCertSecretName := fmt.Sprintf("%s-kes-client-cert", secretName) - kesConfigurationSecret, kesClientCertSecret, err := createOrReplaceKesConfigurationSecrets(ctx, clientSet, namespace, body, kesConfigurationSecretName, kesClientCertSecretName, tenantName) - if err != nil { - return err - } - tenant.Spec.KES.Configuration = kesConfigurationSecret - tenant.Spec.KES.ClientCertSecret = kesClientCertSecret - image := params.Body.Image - if image == "" { - image = miniov2.DefaultKESImage - } - tenant.Spec.KES.Image = image - i, err := strconv.ParseInt(params.Body.Replicas, 10, 32) - if err != nil { - return err - } - tenant.Spec.KES.Replicas = int32(i) - tenant.Spec.KES.SecurityContext, err = convertModelSCToK8sSC(params.Body.SecurityContext) - if err != nil { - return err - } - _, err = operatorClient.TenantUpdate(ctx, tenant, metav1.UpdateOptions{}) - return err -} - -// getTenantDeleteEncryptionResponse is a wrapper for tenantDeleteEncryption -func getTenantDeleteEncryptionResponse(session *models.Principal, params operator_api.TenantDeleteEncryptionParams) *models.Error { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return xerrors.ErrorWithContext(ctx, err, xerrors.ErrDeletingEncryptionConfig) - } - opClient := operatorClient{ - client: opClientClientSet, - } - if err := tenantDeleteEncryption(ctx, &opClient, params.Namespace, params); err != nil { - return xerrors.ErrorWithContext(ctx, err, xerrors.ErrDeletingEncryptionConfig) - } - return nil -} - -// getTenantUpdateEncryptionResponse is a wrapper for tenantUpdateEncryption -func getTenantUpdateEncryptionResponse(session *models.Principal, params operator_api.TenantUpdateEncryptionParams) *models.Error { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - // get Kubernetes Client - clientSet, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return xerrors.ErrorWithContext(ctx, err, xerrors.ErrUpdatingEncryptionConfig) - } - k8sClient := k8sClient{ - client: clientSet, - } - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return xerrors.ErrorWithContext(ctx, err, xerrors.ErrUpdatingEncryptionConfig) - } - opClient := operatorClient{ - client: opClientClientSet, - } - if err := tenantUpdateEncryption(ctx, &opClient, &k8sClient, params.Namespace, params); err != nil { - return xerrors.ErrorWithContext(ctx, err, xerrors.ErrUpdatingEncryptionConfig) - } - return nil -} - -// tenantEncryptionInfo retrieves encryption information for the current tenant -func tenantEncryptionInfo(ctx context.Context, operatorClient OperatorClientI, clientSet K8sClientI, namespace string, params operator_api.TenantEncryptionInfoParams) (*models.EncryptionConfigurationResponse, error) { - tenantName := params.Tenant - tenant, err := operatorClient.TenantGet(ctx, namespace, tenantName, metav1.GetOptions{}) - if err != nil { - return nil, err - } - // Check if encryption is enabled for MinIO via KES - if tenant.HasKESEnabled() { - encryptConfig := &models.EncryptionConfigurationResponse{ - Image: tenant.Spec.KES.Image, - Replicas: fmt.Sprintf("%d", tenant.Spec.KES.Replicas), - } - if tenant.Spec.KES.Image == "" { - encryptConfig.Image = miniov2.GetTenantKesImage() - } - if tenant.Spec.KES.SecurityContext != nil { - encryptConfig.SecurityContext = convertK8sSCToModelSC(tenant.Spec.KES.SecurityContext) - } - if tenant.KESExternalCert() { - kesExternalCerts, err := parseTenantCertificates(ctx, clientSet, tenant.Namespace, []*miniov2.LocalCertificateReference{tenant.Spec.KES.ExternalCertSecret}) - if err != nil { - return nil, err - } - if len(kesExternalCerts) > 0 { - encryptConfig.ServerTLS = kesExternalCerts[0] - } - } - if tenant.ExternalClientCert() { - clientCerts, err := parseTenantCertificates(ctx, clientSet, tenant.Namespace, []*miniov2.LocalCertificateReference{tenant.Spec.ExternalClientCertSecret}) - if err != nil { - return nil, err - } - if len(clientCerts) > 0 { - encryptConfig.MinioMtls = clientCerts[0] - } - } - - if tenant.Spec.KES.Configuration != nil { - configSecret, err := clientSet.getSecret(ctx, tenant.Namespace, tenant.Spec.KES.Configuration.Name, metav1.GetOptions{}) - if err != nil { - return nil, err - } - if rawConfiguration, ok := configSecret.Data["server-config.yaml"]; ok { - kesConfiguration := &kes.ServerConfig{} - // return raw configuration in case the user wants to edit KES configuration manually - encryptConfig.Raw = string(rawConfiguration) - err := yaml.Unmarshal(rawConfiguration, kesConfiguration) - if err != nil { - return nil, err - } - if kesConfiguration.Keys.Vault != nil { - vault := kesConfiguration.Keys.Vault - vaultConfig := &models.VaultConfigurationResponse{ - Prefix: vault.Prefix, - Namespace: vault.Namespace, - Engine: vault.EnginePath, - Endpoint: &vault.Endpoint, - } - if vault.Status != nil { - vaultConfig.Status = &models.VaultConfigurationResponseStatus{ - Ping: int64(vault.Status.Ping.Seconds()), - } - } - if vault.AppRole != nil { - vaultConfig.Approle = &models.VaultConfigurationResponseApprole{ - Engine: vault.AppRole.EnginePath, - ID: &vault.AppRole.ID, - Retry: int64(vault.AppRole.Retry.Seconds()), - Secret: &vault.AppRole.Secret, - } - } - if tenant.KESClientCert() { - encryptConfig.KmsMtls = &models.EncryptionConfigurationResponseAO1KmsMtls{} - clientSecretName := tenant.Spec.KES.ClientCertSecret.Name - keyPair, err := clientSet.getSecret(ctx, namespace, clientSecretName, metav1.GetOptions{}) - if err != nil { - return nil, err - } - // Extract client public certificate - if rawCert, ok := keyPair.Data["client.crt"]; ok { - encryptConfig.KmsMtls.Crt, err = parseCertificate(clientSecretName, rawCert) - if err != nil { - return nil, err - } - } - // Extract client ca certificate - if rawCert, ok := keyPair.Data["ca.crt"]; ok { - encryptConfig.KmsMtls.Ca, err = parseCertificate(clientSecretName, rawCert) - if err != nil { - return nil, err - } - } - } - encryptConfig.Vault = vaultConfig - } - if kesConfiguration.Keys.Aws != nil { - awsJSON, err := json.Marshal(kesConfiguration.Keys.Aws) - if err != nil { - return nil, err - } - awsConfig := &models.AwsConfiguration{} - err = json.Unmarshal(awsJSON, awsConfig) - if err != nil { - return nil, err - } - encryptConfig.Aws = awsConfig - } - if kesConfiguration.Keys.Gcp != nil { - gcpJSON, err := json.Marshal(kesConfiguration.Keys.Gcp) - if err != nil { - return nil, err - } - gcpConfig := &models.GcpConfiguration{} - err = json.Unmarshal(gcpJSON, gcpConfig) - if err != nil { - return nil, err - } - encryptConfig.Gcp = gcpConfig - } - if kesConfiguration.Keys.Gemalto != nil { - gemalto := kesConfiguration.Keys.Gemalto - gemaltoConfig := &models.GemaltoConfigurationResponse{ - Keysecure: &models.GemaltoConfigurationResponseKeysecure{}, - } - if gemalto.KeySecure != nil { - gemaltoConfig.Keysecure.Endpoint = &gemalto.KeySecure.Endpoint - if gemalto.KeySecure.Credentials != nil { - gemaltoConfig.Keysecure.Credentials = &models.GemaltoConfigurationResponseKeysecureCredentials{ - Domain: &gemalto.KeySecure.Credentials.Domain, - Retry: int64(gemalto.KeySecure.Credentials.Retry.Seconds()), - Token: &gemalto.KeySecure.Credentials.Token, - } - } - if gemalto.KeySecure.TLS != nil { - if tenant.KESClientCert() { - encryptConfig.KmsMtls = &models.EncryptionConfigurationResponseAO1KmsMtls{} - clientSecretName := tenant.Spec.KES.ClientCertSecret.Name - keyPair, err := clientSet.getSecret(ctx, namespace, clientSecretName, metav1.GetOptions{}) - if err != nil { - return nil, err - } - // Extract client ca certificate - if rawCert, ok := keyPair.Data["ca.crt"]; ok { - encryptConfig.KmsMtls.Ca, err = parseCertificate(clientSecretName, rawCert) - if err != nil { - return nil, err - } - } - } - } - } - encryptConfig.Gemalto = gemaltoConfig - } - if kesConfiguration.Keys.Azure != nil { - azureJSON, err := json.Marshal(kesConfiguration.Keys.Azure) - if err != nil { - return nil, err - } - azureConfig := &models.AzureConfiguration{} - err = json.Unmarshal(azureJSON, azureConfig) - if err != nil { - return nil, err - } - encryptConfig.Azure = azureConfig - } - } - } - return encryptConfig, nil - } - return nil, xerrors.ErrEncryptionConfigNotFound -} - -// getTenantEncryptionResponse is a wrapper for tenantEncryptionInfo -func getTenantEncryptionInfoResponse(session *models.Principal, params operator_api.TenantEncryptionInfoParams) (*models.EncryptionConfigurationResponse, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - // get Kubernetes Client - clientSet, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, xerrors.ErrorWithContext(ctx, err, xerrors.ErrEncryptionConfigNotFound) - } - k8sClient := k8sClient{ - client: clientSet, - } - opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken) - if err != nil { - return nil, xerrors.ErrorWithContext(ctx, err, xerrors.ErrEncryptionConfigNotFound) - } - opClient := operatorClient{ - client: opClientClientSet, - } - configuration, err := tenantEncryptionInfo(ctx, &opClient, &k8sClient, params.Namespace, params) - if err != nil { - return nil, xerrors.ErrorWithContext(ctx, err) - } - return configuration, nil -} - -// getKESConfiguration will generate the KES server certificate secrets, the tenant client secrets for mTLS authentication between MinIO and KES and the -// kes-configuration.yaml file used by the KES service (how to connect to the external KMS, eg: Vault, AWS, Gemalto, etc) -func getKESConfiguration(ctx context.Context, clientSet K8sClientI, ns string, encryptionCfg *models.EncryptionConfiguration, secretName, tenantName string) (kesConfiguration *miniov2.KESConfig, err error) { - // Secrets used by the KES service - // - // kesExternalCertSecretName is the name of the secret that will store the certificates for TLS in the KES server, eg: server.key and server.crt - kesExternalCertSecretName := fmt.Sprintf("%s-kes-external-cert", secretName) - // kesClientCertSecretName is the name of the secret that will store the certificates for mTLS between KES and the KMS, eg: mTLS with Vault or Gemalto KMS - kesClientCertSecretName := fmt.Sprintf("%s-kes-client-cert", secretName) - // kesConfigurationSecretName is the name of the secret that will store the configuration file, eg: kes-configuration.yaml - kesConfigurationSecretName := fmt.Sprintf("%s-kes-configuration", secretName) - - kesConfiguration = &miniov2.KESConfig{ - Image: KESImageVersion, - Replicas: 1, - } - // Using custom image for KES - if encryptionCfg.Image != "" { - kesConfiguration.Image = encryptionCfg.Image - } - // Using custom replicas for KES - if encryptionCfg.Replicas != "" { - replicas, errReplicas := strconv.Atoi(encryptionCfg.Replicas) - if errReplicas != nil { - kesConfiguration.Replicas = int32(replicas) - } - } - // Generate server certificates for KES - if encryptionCfg.ServerTLS != nil { - certificates := []*models.KeyPairConfiguration{encryptionCfg.ServerTLS} - certificateSecrets, err := createOrReplaceExternalCertSecrets(ctx, clientSet, ns, certificates, kesExternalCertSecretName, tenantName) - if err != nil { - return nil, err - } - if len(certificateSecrets) > 0 { - // External TLS certificates used by KES - kesConfiguration.ExternalCertSecret = certificateSecrets[0] - } - } - // Prepare kesConfiguration for KES - serverConfigSecret, clientCertSecret, err := createOrReplaceKesConfigurationSecrets(ctx, clientSet, ns, encryptionCfg, kesConfigurationSecretName, kesClientCertSecretName, tenantName) - if err != nil { - return nil, err - } - // Configuration used by KES - kesConfiguration.Configuration = serverConfigSecret - kesConfiguration.ClientCertSecret = clientCertSecret - - return kesConfiguration, nil -} - -type tenantSecret struct { - Name string - Content map[string][]byte -} - -// createOrReplaceSecrets receives an array of Tenant Secrets to be stored as k8s secrets -func createOrReplaceSecrets(ctx context.Context, clientSet K8sClientI, ns string, secrets []tenantSecret, tenantName string) ([]*miniov2.LocalCertificateReference, error) { - var k8sSecrets []*miniov2.LocalCertificateReference - for _, secret := range secrets { - if len(secret.Content) > 0 && secret.Name != "" { - // delete secret with same name if exists - err := clientSet.deleteSecret(ctx, ns, secret.Name, metav1.DeleteOptions{}) - if err != nil { - // log the errors if any and continue - xerrors.LogError("deleting secret name %s failed: %v, continuing..", secret.Name, err) - } - k8sSecret := &corev1.Secret{ - ObjectMeta: metav1.ObjectMeta{ - Name: secret.Name, - Labels: map[string]string{ - miniov2.TenantLabel: tenantName, - }, - }, - Type: corev1.SecretTypeOpaque, - Data: secret.Content, - } - _, err = clientSet.createSecret(ctx, ns, k8sSecret, metav1.CreateOptions{}) - if err != nil { - return nil, err - } - k8sSecrets = append(k8sSecrets, &miniov2.LocalCertificateReference{ - Name: secret.Name, - Type: "Opaque", - }) - } - } - return k8sSecrets, nil -} - -// createOrReplaceExternalCertSecrets receives an array of KeyPairs (public and private key), encoded in base64, decode it and generate an equivalent number of kubernetes -// secrets to be used by the miniov2 for TLS encryption -func createOrReplaceExternalCertSecrets(ctx context.Context, clientSet K8sClientI, ns string, keyPairs []*models.KeyPairConfiguration, secretName, tenantName string) ([]*miniov2.LocalCertificateReference, error) { - var keyPairSecrets []*miniov2.LocalCertificateReference - for i, keyPair := range keyPairs { - keyPairSecretName := fmt.Sprintf("%s-%d", secretName, i) - if keyPair == nil || keyPair.Crt == nil || keyPair.Key == nil || *keyPair.Crt == "" || *keyPair.Key == "" { - return nil, errors.New("certificate files must not be empty") - } - // delete secret with same name if exists - err := clientSet.deleteSecret(ctx, ns, keyPairSecretName, metav1.DeleteOptions{}) - if err != nil { - // log the errors if any and continue - xerrors.LogError("deleting secret name %s failed: %v, continuing..", keyPairSecretName, err) - } - imm := true - tlsCrt, err := base64.StdEncoding.DecodeString(*keyPair.Crt) - if err != nil { - return nil, err - } - tlsKey, err := base64.StdEncoding.DecodeString(*keyPair.Key) - if err != nil { - return nil, err - } - // check if the key pair is valid - if _, err = tls.X509KeyPair(tlsCrt, tlsKey); err != nil { - return nil, err - } - externalTLSCertificateSecret := &corev1.Secret{ - ObjectMeta: metav1.ObjectMeta{ - Name: keyPairSecretName, - Labels: map[string]string{ - miniov2.TenantLabel: tenantName, - }, - }, - Type: corev1.SecretTypeTLS, - Immutable: &imm, - Data: map[string][]byte{ - "tls.crt": tlsCrt, - "tls.key": tlsKey, - }, - } - _, err = clientSet.createSecret(ctx, ns, externalTLSCertificateSecret, metav1.CreateOptions{}) - if err != nil { - return nil, err - } - // Certificates used by the minio instance - keyPairSecrets = append(keyPairSecrets, &miniov2.LocalCertificateReference{ - Name: keyPairSecretName, - Type: "kubernetes.io/tls", - }) - } - return keyPairSecrets, nil -} - -func createOrReplaceKesConfigurationSecrets(ctx context.Context, clientSet K8sClientI, ns string, encryptionCfg *models.EncryptionConfiguration, kesConfigurationSecretName, kesClientCertSecretName, tenantName string) (*corev1.LocalObjectReference, *miniov2.LocalCertificateReference, error) { - // if autoCert is enabled then Operator will generate the client certificates, calculate the client cert identity - // and pass it to KES via the ${MINIO_KES_IDENTITY} variable - clientCrtIdentity := "${MINIO_KES_IDENTITY}" - // If a client certificate is provided proceed to calculate the identity - if encryptionCfg.MinioMtls != nil { - // Client certificate for KES used by Minio to mTLS - clientTLSCrt, err := base64.StdEncoding.DecodeString(*encryptionCfg.MinioMtls.Crt) - if err != nil { - return nil, nil, err - } - // Calculate the client cert identity based on the clientTLSCrt - h := crypto.SHA256.New() - certificate, err := kes.ParseCertificate(clientTLSCrt) - if err != nil { - return nil, nil, err - } - h.Write(certificate.RawSubjectPublicKeyInfo) - clientCrtIdentity = hex.EncodeToString(h.Sum(nil)) - } - // Default kesConfiguration for KES - kesConfig := &kes.ServerConfig{ - Addr: "0.0.0.0:7373", - Root: "disabled", - TLS: kes.TLS{ - KeyPath: "/tmp/kes/server.key", - CertPath: "/tmp/kes/server.crt", - }, - Policies: map[string]kes.Policy{ - "default-policy": { - Paths: []string{ - "/v1/key/create/my-minio-key", - "/v1/key/generate/my-minio-key", - "/v1/key/decrypt/my-minio-key", - }, - Identities: []kes.Identity{ - kes.Identity(clientCrtIdentity), - }, - }, - }, - Cache: kes.Cache{ - Expiry: &kes.Expiry{ - Any: 5 * time.Minute, - Unused: 20 * time.Second, - }, - }, - Log: kes.Log{ - Error: "on", - Audit: "off", - }, - Keys: kes.Keys{}, - } - // miniov2 will mount the mTLSCertificates in the following paths - // therefore we set these values in the KES yaml kesConfiguration - mTLSClientCrtPath := "/tmp/kes/client.crt" - mTLSClientKeyPath := "/tmp/kes/client.key" - mTLSClientCaPath := "/tmp/kes/ca.crt" - // map to hold mTLSCertificates for KES mTLS against Vault - mTLSCertificates := map[string][]byte{} - // if encryption is enabled and encryption is configured to use Vault - switch { - case encryptionCfg.Vault != nil: - ping := 10 // default ping - if encryptionCfg.Vault.Status != nil { - ping = int(encryptionCfg.Vault.Status.Ping) - } - // Initialize Vault Config - kesConfig.Keys.Vault = &kes.Vault{ - Endpoint: *encryptionCfg.Vault.Endpoint, - EnginePath: encryptionCfg.Vault.Engine, - Namespace: encryptionCfg.Vault.Namespace, - Prefix: encryptionCfg.Vault.Prefix, - Status: &kes.VaultStatus{ - Ping: time.Duration(ping) * time.Second, - }, - } - // Vault AppRole credentials - if encryptionCfg.Vault.Approle != nil { - retry := encryptionCfg.Vault.Approle.Retry - kesConfig.Keys.Vault.AppRole = &kes.AppRole{ - EnginePath: encryptionCfg.Vault.Approle.Engine, - ID: *encryptionCfg.Vault.Approle.ID, - Secret: *encryptionCfg.Vault.Approle.Secret, - Retry: time.Duration(retry) * time.Second, - } - } else { - return nil, nil, errors.New("approle credentials missing for kes") - } - // Vault mTLS kesConfiguration - if encryptionCfg.KmsMtls != nil { - vaultTLSConfig := encryptionCfg.KmsMtls - kesConfig.Keys.Vault.TLS = &kes.VaultTLS{} - if vaultTLSConfig.Crt != "" { - clientCrt, err := base64.StdEncoding.DecodeString(vaultTLSConfig.Crt) - if err != nil { - return nil, nil, err - } - mTLSCertificates["client.crt"] = clientCrt - kesConfig.Keys.Vault.TLS.CertPath = mTLSClientCrtPath - } - if vaultTLSConfig.Key != "" { - clientKey, err := base64.StdEncoding.DecodeString(vaultTLSConfig.Key) - if err != nil { - return nil, nil, err - } - mTLSCertificates["client.key"] = clientKey - kesConfig.Keys.Vault.TLS.KeyPath = mTLSClientKeyPath - } - if vaultTLSConfig.Ca != "" { - caCrt, err := base64.StdEncoding.DecodeString(vaultTLSConfig.Ca) - if err != nil { - return nil, nil, err - } - mTLSCertificates["ca.crt"] = caCrt - kesConfig.Keys.Vault.TLS.CAPath = mTLSClientCaPath - } - } - case encryptionCfg.Aws != nil: - // Initialize AWS - kesConfig.Keys.Aws = &kes.Aws{ - SecretsManager: &kes.AwsSecretManager{}, - } - // AWS basic kesConfiguration - if encryptionCfg.Aws.Secretsmanager != nil { - kesConfig.Keys.Aws.SecretsManager.Endpoint = *encryptionCfg.Aws.Secretsmanager.Endpoint - kesConfig.Keys.Aws.SecretsManager.Region = *encryptionCfg.Aws.Secretsmanager.Region - kesConfig.Keys.Aws.SecretsManager.KmsKey = encryptionCfg.Aws.Secretsmanager.Kmskey - // AWS credentials - if encryptionCfg.Aws.Secretsmanager.Credentials != nil { - kesConfig.Keys.Aws.SecretsManager.Login = &kes.AwsSecretManagerLogin{ - AccessKey: *encryptionCfg.Aws.Secretsmanager.Credentials.Accesskey, - SecretKey: *encryptionCfg.Aws.Secretsmanager.Credentials.Secretkey, - SessionToken: encryptionCfg.Aws.Secretsmanager.Credentials.Token, - } - } - } - case encryptionCfg.Gemalto != nil: - // Initialize Gemalto - kesConfig.Keys.Gemalto = &kes.Gemalto{ - KeySecure: &kes.GemaltoKeySecure{}, - } - // Gemalto Configuration - if encryptionCfg.Gemalto.Keysecure != nil { - kesConfig.Keys.Gemalto.KeySecure.Endpoint = *encryptionCfg.Gemalto.Keysecure.Endpoint - // Gemalto TLS kesConfiguration - if encryptionCfg.KmsMtls != nil { - if encryptionCfg.KmsMtls.Ca != "" { - caCrt, err := base64.StdEncoding.DecodeString(encryptionCfg.KmsMtls.Ca) - if err != nil { - return nil, nil, err - } - mTLSCertificates["ca.crt"] = caCrt - kesConfig.Keys.Gemalto.KeySecure.TLS = &kes.GemaltoTLS{ - CAPath: mTLSClientCaPath, - } - } - } - // Gemalto Login - if encryptionCfg.Gemalto.Keysecure.Credentials != nil { - kesConfig.Keys.Gemalto.KeySecure.Credentials = &kes.GemaltoCredentials{ - Token: *encryptionCfg.Gemalto.Keysecure.Credentials.Token, - Domain: *encryptionCfg.Gemalto.Keysecure.Credentials.Domain, - Retry: 15 * time.Second, - } - } - } - case encryptionCfg.Gcp != nil: - // Initialize GCP - kesConfig.Keys.Gcp = &kes.Gcp{ - SecretManager: &kes.GcpSecretManager{}, - } - // GCP basic kesConfiguration - if encryptionCfg.Gcp.Secretmanager != nil { - kesConfig.Keys.Gcp.SecretManager.ProjectID = *encryptionCfg.Gcp.Secretmanager.ProjectID - kesConfig.Keys.Gcp.SecretManager.Endpoint = encryptionCfg.Gcp.Secretmanager.Endpoint - // GCP credentials - if encryptionCfg.Gcp.Secretmanager.Credentials != nil { - kesConfig.Keys.Gcp.SecretManager.Credentials = &kes.GcpCredentials{ - ClientEmail: encryptionCfg.Gcp.Secretmanager.Credentials.ClientEmail, - ClientID: encryptionCfg.Gcp.Secretmanager.Credentials.ClientID, - PrivateKeyID: encryptionCfg.Gcp.Secretmanager.Credentials.PrivateKeyID, - PrivateKey: encryptionCfg.Gcp.Secretmanager.Credentials.PrivateKey, - } - } - } - case encryptionCfg.Azure != nil: - // Initialize Azure - kesConfig.Keys.Azure = &kes.Azure{ - KeyVault: &kes.AzureKeyVault{}, - } - if encryptionCfg.Azure.Keyvault != nil { - kesConfig.Keys.Azure.KeyVault.Endpoint = *encryptionCfg.Azure.Keyvault.Endpoint - if encryptionCfg.Azure.Keyvault.Credentials != nil { - kesConfig.Keys.Azure.KeyVault.Credentials = &kes.AzureCredentials{ - TenantID: *encryptionCfg.Azure.Keyvault.Credentials.TenantID, - ClientID: *encryptionCfg.Azure.Keyvault.Credentials.ClientID, - ClientSecret: *encryptionCfg.Azure.Keyvault.Credentials.ClientSecret, - } - } - } - } - imm := true - // if mTLSCertificates contains elements we create the kubernetes secret - var clientCertSecretReference *miniov2.LocalCertificateReference - if len(mTLSCertificates) > 0 { - // delete KES client cert secret only if new client certificates are provided - if err := clientSet.deleteSecret(ctx, ns, kesClientCertSecretName, metav1.DeleteOptions{}); err != nil { - // log the errors if any and continue - xerrors.LogError("deleting secret name %s failed: %v, continuing..", kesClientCertSecretName, err) - } - // Secret to store KES mTLS kesConfiguration to authenticate against a KMS - kesClientCertSecret := corev1.Secret{ - ObjectMeta: metav1.ObjectMeta{ - Name: kesClientCertSecretName, - Labels: map[string]string{ - miniov2.TenantLabel: tenantName, - }, - }, - Immutable: &imm, - Data: mTLSCertificates, - } - _, err := clientSet.createSecret(ctx, ns, &kesClientCertSecret, metav1.CreateOptions{}) - if err != nil { - return nil, nil, err - } - // kubernetes generic secret - clientCertSecretReference = &miniov2.LocalCertificateReference{ - Name: kesClientCertSecretName, - } - } - - var serverRawConfig []byte - var err error - - if encryptionCfg.Raw != "" { - serverRawConfig = []byte(encryptionCfg.Raw) - // verify provided configuration is in valid YAML format - var configTest kes.ServerConfig - err = yaml.Unmarshal(serverRawConfig, &configTest) - if err != nil { - return nil, nil, err - } - } else { - // Generate Yaml kesConfiguration for KES - serverRawConfig, err = yaml.Marshal(kesConfig) - if err != nil { - return nil, nil, err - } - } - - // delete KES configuration secret if exists - if err := clientSet.deleteSecret(ctx, ns, kesConfigurationSecretName, metav1.DeleteOptions{}); err != nil { - // log the errors if any and continue - xerrors.LogError("deleting secret name %s failed: %v, continuing..", kesConfigurationSecretName, err) - } - - // Secret to store KES server kesConfiguration - kesConfigurationSecret := corev1.Secret{ - ObjectMeta: metav1.ObjectMeta{ - Name: kesConfigurationSecretName, - Labels: map[string]string{ - miniov2.TenantLabel: tenantName, - }, - }, - Immutable: &imm, - Data: map[string][]byte{ - "server-config.yaml": serverRawConfig, - }, - } - _, err = clientSet.createSecret(ctx, ns, &kesConfigurationSecret, metav1.CreateOptions{}) - return &corev1.LocalObjectReference{ - Name: kesConfigurationSecretName, - }, clientCertSecretReference, err -} diff --git a/operatorapi/tenants_helper_test.go b/operatorapi/tenants_helper_test.go deleted file mode 100644 index 6b5cab1d5..000000000 --- a/operatorapi/tenants_helper_test.go +++ /dev/null @@ -1,375 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "errors" - "reflect" - "testing" - - "github.com/minio/console/operatorapi/operations/operator_api" - - "github.com/minio/console/models" - miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func Test_tenantUpdateCertificates(t *testing.T) { - k8sClient := k8sClientMock{} - opClient := opClientMock{} - crt := "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUUzRENDQTBTZ0F3SUJBZ0lRS0pDalNyK0xaMnJrYVo5ODAvZnV5akFOQmdrcWhraUc5dzBCQVFzRkFEQ0IKdFRFZU1Cd0dBMVVFQ2hNVmJXdGpaWEowSUdSbGRtVnNiM0J0Wlc1MElFTkJNVVV3UXdZRFZRUUxERHhoYkdWMgpjMnRBVEdWdWFXNXpMVTFoWTBKdmIyc3RVSEp2TG14dlkyRnNJQ2hNWlc1cGJpQkJiR1YyYzJ0cElFaDFaWEowCllTQkJjbWxoY3lreFREQktCZ05WQkFNTVEyMXJZMlZ5ZENCaGJHVjJjMnRBVEdWdWFXNXpMVTFoWTBKdmIyc3QKVUhKdkxteHZZMkZzSUNoTVpXNXBiaUJCYkdWMmMydHBJRWgxWlhKMFlTQkJjbWxoY3lrd0hoY05NVGt3TmpBeApNREF3TURBd1doY05NekF3T0RBeU1ERTFNekEzV2pCaU1TY3dKUVlEVlFRS0V4NXRhMk5sY25RZ1pHVjJaV3h2CmNHMWxiblFnWTJWeWRHbG1hV05oZEdVeE56QTFCZ05WQkFzTUxtRnNaWFp6YTBCMGFXWmhMbXh2WTJGc0lDaE0KWlc1cGJpQkJiR1YyYzJ0cElFaDFaWEowWVNCQmNtbGhjeWt3Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQgpEd0F3Z2dFS0FvSUJBUUM2dlhLVyswWmhJQUNycmpxTU9QZ3VSdGpSemk1L0VxK2JvZTJkQ1BpT3djdXo0WFlhCm1rVlcxSkhBS3VTc0I1UHE0QnFSRXFueUhYT0ZROWQ1bEFjRGNDYmhlTFRVb2h2ZkhOWW9SdWRrYkZ3RzAyOFQKdVMxTFNtcHU5VjhFU2Q0Q3BiOGRvUkcvUW8vRTF4RGk5STFhNVhoeUdHTTNsUFlYQU1HU1ZkWUNNNzh0M2ZLTwp0NFVlcEt6d2dFQ2NKRVg4MVFoem1ZT25ELysyazNxSVppZU9nOGFkbDNFUWV2eFBISXlXQ1JkaDJZTkZsRi9rCmEwTzQyRVl2NVNUT1N0dzI2TzMwTVRrcEg0dzRRZm9VV3BnZU93MDZyYTluRHdzV3VhMUZIaHlKZmxOanR1USsKU0NlaDdqTVlVUThYV1JkbXVHbzFRT0g5cjdDKy82L1JhMlZIQWdNQkFBR2pnYmt3Z2JZd0RnWURWUjBQQVFILwpCQVFEQWdXZ01CTUdBMVVkSlFRTU1Bb0dDQ3NHQVFVRkJ3TUJNQXdHQTFVZEV3RUIvd1FDTUFBd0h3WURWUjBqCkJCZ3dGb0FVNHg4NUIyeGVlQzg0UEdvM1dZVWwxRGVvZlFNd1lBWURWUjBSQkZrd1Y0SWpLaTV0YVc1cGJ5MWgKYkdWMmMyc3Ribk11YzNaakxtTnNkWE4wWlhJdWJHOWpZV3lDTUNvdWFHOXVaWGwzWld4c0xXaHNMbTFwYm1sdgpMV0ZzWlhaemF5MXVjeTV6ZG1NdVkyeDFjM1JsY2k1c2IyTmhiREFOQmdrcWhraUc5dzBCQVFzRkFBT0NBWUVBCnZnMFlIVGtzd3Z4NEE5ZXl0b1V3eTBOSFVjQXpuNy9BVCt3WEt6d3Fqa0RiS3hVYlFTMFNQVVI4SkVDMkpuUUgKU3pTNGFCNXRURVRYZUcrbHJZVU02b0RNcXlIalpUN1NJaW83OUNxOFloWWxORU9qMkhvaXdxalczZm10UU9kVApoVG1tS01lRnZleHo2cnRxbHp0cVdKa3kvOGd1MkMrMWw5UDFFUmhFNDZZY0puVmJ5REFTSGNvV2tiZVhFUGErCjNpNFd4bU1yMDlNZXFTNkFUb2NKanFBeEtYcURYWmlFZjRUVEp1ZTRBQ2s4WmhqaEtUUEV6RnQ3WllVaHY3dVoKdlZCOXhla2FqRzdMRU5kSHZncXVMRUxUV3czWkpBaXpSTU5KUUpzZU11LzdQN1NIeXRKTVJYdlVwd2R2dWhDOApKNm54aGRmUS91QVlQY1lHdlU5NUZPZ1NjWVZqNW1WQktXM0ZHbkl2YzZuamQ1OFhBSTE3dlk0K0ZZTnY4M2UxCm9mOGlxRFdWNTFyT1FlbG9FZFdmdHkvZTI2bXVWUUQzQlVjY2Z5SWpGYy9SeGNHdm5maUEwUm1uRDNkWFcyZ0oKUHFTd01ZZ3hxQndqMm1Qck5jdkFWY3BOeWRjTWJKOTFIOHRWY0ttRHMrY1NiV0tnblpmKzUvZm5yaTdmU3FLUQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==" - key := "LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUV2Z0lCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQktnd2dnU2tBZ0VBQW9JQkFRQzZ2WEtXKzBaaElBQ3IKcmpxTU9QZ3VSdGpSemk1L0VxK2JvZTJkQ1BpT3djdXo0WFlhbWtWVzFKSEFLdVNzQjVQcTRCcVJFcW55SFhPRgpROWQ1bEFjRGNDYmhlTFRVb2h2ZkhOWW9SdWRrYkZ3RzAyOFR1UzFMU21wdTlWOEVTZDRDcGI4ZG9SRy9Rby9FCjF4RGk5STFhNVhoeUdHTTNsUFlYQU1HU1ZkWUNNNzh0M2ZLT3Q0VWVwS3p3Z0VDY0pFWDgxUWh6bVlPbkQvKzIKazNxSVppZU9nOGFkbDNFUWV2eFBISXlXQ1JkaDJZTkZsRi9rYTBPNDJFWXY1U1RPU3R3MjZPMzBNVGtwSDR3NApRZm9VV3BnZU93MDZyYTluRHdzV3VhMUZIaHlKZmxOanR1UStTQ2VoN2pNWVVROFhXUmRtdUdvMVFPSDlyN0MrCi82L1JhMlZIQWdNQkFBRUNnZ0VCQUlyTlVFUnJSM2ZmK3IraGhJRS93ekZhbGNUMUZWaDh3aXpUWXJQcnZCMFkKYlZvcVJzZ2xUVTdxTjkvM3dmc2dzdEROZk5IQ1pySEJOR0drK0orMDZMV2tnakhycjdXeFBUaE16ZDRvUGN4RwpRdTBMOGE5ZVlBMXJwY3NOOVc5Um5JU3BRSEk4aTkxM0V6Z0RoOWk2WCt0bFQyNjNNK0JYaDhlM1Z5cDNSTmhpCjZZUTQwcWJsNlQ0TUlyLzRSMGJmcFExZWVMNVNnbHB6Z1d6ZGs4WGtmc0E5YnRiU1RoMjZKRlBPUU1tMm5adkcKbjBlZm85TDZtaktwRW9rRWpTY1hWYTRZNHJaREZFYTVIbkpUSDBHblByQzU1cDhBb3BFN1c1M2RDT3lxd29CcQo4SWtZb2grcm1qTUZrOGc5VlRVYlcwVE9YVTFSY1E1Z0gxWS9jam5uVTRrQ2dZRUE4amw5ZEQyN2JaQ2ZaTW9jCjJYRThiYkJTaFVXTjRvaklKc1lHY2xyTjJDUEtUNmExaVhvS3BrTXdGNUdsODEzQURGR1pTbWtUSUFVQXRXQU8KNzZCcEpGUlVCZ1hmUXhSU0gyS1RaRldxbE5yekZPQjNsT3h2bFJ1amw5eE9ueStyWUhJWC9BOWNqQlp3a2orSAo3MDZRTExvS1ZFL2lMYy9DMlI5VzRLRVI3R3NDZ1lFQXhWd3FyM1JnUXhHUmpueG1zbDZtUW5DQ3k2MXFoUzUxCkJicDJzWldraFNTV0w0YzFDY0NDMnZ2ektPSmJkZ2NZQU43L05sTHgzWjlCZUFjTVZMUEVoc2NPalB6YUlneEMKczJ2UkdwQUFtYnRjWi9MVlpKaERWTjIrSHowRHhnRUtCa1JzQU5XTG51cGRoUWJBdlZuTkVsY29YVlo1cC9qcwp3U1BCelFoSklaVUNnWUJqTUlHY0dTOW9SWUhRRHlmVEx4aVV2bEI4ZktnR2JRYXhRZ1FmemVsZktnRE5yekhGCnN6RXJOblk2SUkxNVpCbWhzY1I1QVNBd3kzdW55a2N6ZjFldTVjMW1qZjhJQkFsQkN1ZmFmVzRWK0xiMEJKdFQKWTZLcHg2Q3RMaTBQNk1CZ0JUaW5JazgrbW0zTXBiRnZvSmRQaVh0elhTYjhwWWhmeXdLVGg4SEVNd0tCZ1FDUwpvR0VPTFpYKy9pUjRDYkI2d0pzaExWbmZYSjJSQ096a0xwNVVYV3IzaURFVWFvMWJDMjJzcUJjRnZ2WllmL2l6ClhQbWJNSkNGS1BhSTZDT2ZJbGZXRWptYlFaZ0dSN21lZDNISkhFZDE3NTg5azBvN0RHeXB0bnl6MUs3akFvNmkKRFY5NFZ5NytCLzBuQWRkY1ZrVm5aTjJXU3RMam1xcTY2NGZtZmt0bTZRS0JnQzBsMk5OVlFWK2N0OFFRRFpINQpBRFIrSGM3Qk0wNDhURGhNTmhoR3JHc2tWNngwMCtMZTdISGdpT3h2NXJudkNlTlY2M001YUZHdFVWbllTN1VoCkE1NndaNVlZeFFnQ0xzNi9PRmZhK3NiTngrSjdnSjRjNXdMZVlJMXVPMTlzZHBHa2VHZ25vK3dXVmxDSzFCbW0KRGM0TXA2STRiUTVtdy93YVpLQnpjRTJLCi0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K" - badCrt := "ASD" - badKey := "ASD" - type args struct { - ctx context.Context - opClient OperatorClientI - clientSet K8sClientI - namespace string - params operator_api.TenantUpdateCertificateParams - mockTenantGet func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) - mockDeleteSecret func(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error - mockCreateSecret func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) - mockDeletePodCollection func(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - } - tests := []struct { - name string - args args - wantErr bool - }{ - { - name: "error getting tenant information", - args: args{ - ctx: context.Background(), - opClient: opClient, - clientSet: k8sClient, - namespace: "", - params: operator_api.TenantUpdateCertificateParams{}, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return nil, errors.New("invalid tenant") - }, - }, - wantErr: true, - }, - { - name: "error replacing external certs for tenant because of empty keypair values", - args: args{ - ctx: context.Background(), - opClient: opClient, - clientSet: k8sClient, - namespace: "", - params: operator_api.TenantUpdateCertificateParams{ - Body: &models.TLSConfiguration{ - MinioServerCertificates: []*models.KeyPairConfiguration{ - { - Crt: nil, - Key: nil, - }, - }, - }, - }, - mockDeletePodCollection: func(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return nil - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - ExternalCertSecret: []*miniov2.LocalCertificateReference{ - { - Name: "secret", - }, - }, - }, - }, nil - }, - }, - wantErr: true, - }, - { - name: "error replacing external certs for tenant because of malformed encoded certs", - args: args{ - ctx: context.Background(), - opClient: opClient, - clientSet: k8sClient, - namespace: "", - params: operator_api.TenantUpdateCertificateParams{ - Body: &models.TLSConfiguration{ - MinioServerCertificates: []*models.KeyPairConfiguration{ - { - Crt: &badCrt, - Key: &badKey, - }, - }, - }, - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - ExternalCertSecret: []*miniov2.LocalCertificateReference{ - { - Name: "secret", - }, - }, - }, - }, nil - }, - mockDeleteSecret: func(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error { - return nil - }, - }, - wantErr: true, - }, - { - name: "error replacing external certs for tenant because of error during secret creation", - args: args{ - ctx: context.Background(), - opClient: opClient, - clientSet: k8sClient, - namespace: "", - params: operator_api.TenantUpdateCertificateParams{ - Body: &models.TLSConfiguration{ - MinioServerCertificates: []*models.KeyPairConfiguration{ - { - Crt: &crt, - Key: &key, - }, - }, - }, - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - ExternalCertSecret: []*miniov2.LocalCertificateReference{ - { - Name: "secret", - }, - }, - }, - }, nil - }, - mockDeleteSecret: func(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error { - return nil - }, - mockCreateSecret: func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) { - return nil, errors.New("error creating secret") - }, - }, - wantErr: true, - }, - } - for _, tt := range tests { - opClientTenantGetMock = tt.args.mockTenantGet - k8sClientDeleteSecretMock = tt.args.mockDeleteSecret - k8sClientCreateSecretMock = tt.args.mockCreateSecret - k8sClientDeletePodCollectionMock = tt.args.mockDeletePodCollection - t.Run(tt.name, func(t *testing.T) { - if err := tenantUpdateCertificates(tt.args.ctx, tt.args.opClient, tt.args.clientSet, tt.args.namespace, tt.args.params); (err != nil) != tt.wantErr { - t.Errorf("tenantUpdateCertificates() error = %v, wantErr %v", err, tt.wantErr) - } - }) - } -} - -func Test_tenantUpdateEncryption(t *testing.T) { - k8sClient := k8sClientMock{} - opClient := opClientMock{} - type args struct { - ctx context.Context - opClient OperatorClientI - clientSet K8sClientI - namespace string - params operator_api.TenantUpdateEncryptionParams - mockTenantGet func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) - mockDeleteSecret func(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error - mockCreateSecret func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) - mockDeletePodCollection func(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - } - tests := []struct { - name string - args args - wantErr bool - }{ - { - name: "error updating encryption configuration because of error getting tenant", - args: args{ - ctx: context.Background(), - opClient: opClient, - clientSet: k8sClient, - namespace: "", - params: operator_api.TenantUpdateEncryptionParams{}, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return nil, errors.New("invalid tenant") - }, - }, - wantErr: true, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - opClientTenantGetMock = tt.args.mockTenantGet - k8sClientDeleteSecretMock = tt.args.mockDeleteSecret - k8sClientCreateSecretMock = tt.args.mockCreateSecret - k8sClientDeletePodCollectionMock = tt.args.mockDeletePodCollection - if err := tenantUpdateEncryption(tt.args.ctx, tt.args.opClient, tt.args.clientSet, tt.args.namespace, tt.args.params); (err != nil) != tt.wantErr { - t.Errorf("tenantUpdateEncryption() error = %v, wantErr %v", err, tt.wantErr) - } - }) - } -} - -func Test_createOrReplaceKesConfigurationSecrets(t *testing.T) { - k8sClient := k8sClientMock{} - crt := "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUUzRENDQTBTZ0F3SUJBZ0lRS0pDalNyK0xaMnJrYVo5ODAvZnV5akFOQmdrcWhraUc5dzBCQVFzRkFEQ0IKdFRFZU1Cd0dBMVVFQ2hNVmJXdGpaWEowSUdSbGRtVnNiM0J0Wlc1MElFTkJNVVV3UXdZRFZRUUxERHhoYkdWMgpjMnRBVEdWdWFXNXpMVTFoWTBKdmIyc3RVSEp2TG14dlkyRnNJQ2hNWlc1cGJpQkJiR1YyYzJ0cElFaDFaWEowCllTQkJjbWxoY3lreFREQktCZ05WQkFNTVEyMXJZMlZ5ZENCaGJHVjJjMnRBVEdWdWFXNXpMVTFoWTBKdmIyc3QKVUhKdkxteHZZMkZzSUNoTVpXNXBiaUJCYkdWMmMydHBJRWgxWlhKMFlTQkJjbWxoY3lrd0hoY05NVGt3TmpBeApNREF3TURBd1doY05NekF3T0RBeU1ERTFNekEzV2pCaU1TY3dKUVlEVlFRS0V4NXRhMk5sY25RZ1pHVjJaV3h2CmNHMWxiblFnWTJWeWRHbG1hV05oZEdVeE56QTFCZ05WQkFzTUxtRnNaWFp6YTBCMGFXWmhMbXh2WTJGc0lDaE0KWlc1cGJpQkJiR1YyYzJ0cElFaDFaWEowWVNCQmNtbGhjeWt3Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQgpEd0F3Z2dFS0FvSUJBUUM2dlhLVyswWmhJQUNycmpxTU9QZ3VSdGpSemk1L0VxK2JvZTJkQ1BpT3djdXo0WFlhCm1rVlcxSkhBS3VTc0I1UHE0QnFSRXFueUhYT0ZROWQ1bEFjRGNDYmhlTFRVb2h2ZkhOWW9SdWRrYkZ3RzAyOFQKdVMxTFNtcHU5VjhFU2Q0Q3BiOGRvUkcvUW8vRTF4RGk5STFhNVhoeUdHTTNsUFlYQU1HU1ZkWUNNNzh0M2ZLTwp0NFVlcEt6d2dFQ2NKRVg4MVFoem1ZT25ELysyazNxSVppZU9nOGFkbDNFUWV2eFBISXlXQ1JkaDJZTkZsRi9rCmEwTzQyRVl2NVNUT1N0dzI2TzMwTVRrcEg0dzRRZm9VV3BnZU93MDZyYTluRHdzV3VhMUZIaHlKZmxOanR1USsKU0NlaDdqTVlVUThYV1JkbXVHbzFRT0g5cjdDKy82L1JhMlZIQWdNQkFBR2pnYmt3Z2JZd0RnWURWUjBQQVFILwpCQVFEQWdXZ01CTUdBMVVkSlFRTU1Bb0dDQ3NHQVFVRkJ3TUJNQXdHQTFVZEV3RUIvd1FDTUFBd0h3WURWUjBqCkJCZ3dGb0FVNHg4NUIyeGVlQzg0UEdvM1dZVWwxRGVvZlFNd1lBWURWUjBSQkZrd1Y0SWpLaTV0YVc1cGJ5MWgKYkdWMmMyc3Ribk11YzNaakxtTnNkWE4wWlhJdWJHOWpZV3lDTUNvdWFHOXVaWGwzWld4c0xXaHNMbTFwYm1sdgpMV0ZzWlhaemF5MXVjeTV6ZG1NdVkyeDFjM1JsY2k1c2IyTmhiREFOQmdrcWhraUc5dzBCQVFzRkFBT0NBWUVBCnZnMFlIVGtzd3Z4NEE5ZXl0b1V3eTBOSFVjQXpuNy9BVCt3WEt6d3Fqa0RiS3hVYlFTMFNQVVI4SkVDMkpuUUgKU3pTNGFCNXRURVRYZUcrbHJZVU02b0RNcXlIalpUN1NJaW83OUNxOFloWWxORU9qMkhvaXdxalczZm10UU9kVApoVG1tS01lRnZleHo2cnRxbHp0cVdKa3kvOGd1MkMrMWw5UDFFUmhFNDZZY0puVmJ5REFTSGNvV2tiZVhFUGErCjNpNFd4bU1yMDlNZXFTNkFUb2NKanFBeEtYcURYWmlFZjRUVEp1ZTRBQ2s4WmhqaEtUUEV6RnQ3WllVaHY3dVoKdlZCOXhla2FqRzdMRU5kSHZncXVMRUxUV3czWkpBaXpSTU5KUUpzZU11LzdQN1NIeXRKTVJYdlVwd2R2dWhDOApKNm54aGRmUS91QVlQY1lHdlU5NUZPZ1NjWVZqNW1WQktXM0ZHbkl2YzZuamQ1OFhBSTE3dlk0K0ZZTnY4M2UxCm9mOGlxRFdWNTFyT1FlbG9FZFdmdHkvZTI2bXVWUUQzQlVjY2Z5SWpGYy9SeGNHdm5maUEwUm1uRDNkWFcyZ0oKUHFTd01ZZ3hxQndqMm1Qck5jdkFWY3BOeWRjTWJKOTFIOHRWY0ttRHMrY1NiV0tnblpmKzUvZm5yaTdmU3FLUQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==" - key := "LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUV2Z0lCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQktnd2dnU2tBZ0VBQW9JQkFRQzZ2WEtXKzBaaElBQ3IKcmpxTU9QZ3VSdGpSemk1L0VxK2JvZTJkQ1BpT3djdXo0WFlhbWtWVzFKSEFLdVNzQjVQcTRCcVJFcW55SFhPRgpROWQ1bEFjRGNDYmhlTFRVb2h2ZkhOWW9SdWRrYkZ3RzAyOFR1UzFMU21wdTlWOEVTZDRDcGI4ZG9SRy9Rby9FCjF4RGk5STFhNVhoeUdHTTNsUFlYQU1HU1ZkWUNNNzh0M2ZLT3Q0VWVwS3p3Z0VDY0pFWDgxUWh6bVlPbkQvKzIKazNxSVppZU9nOGFkbDNFUWV2eFBISXlXQ1JkaDJZTkZsRi9rYTBPNDJFWXY1U1RPU3R3MjZPMzBNVGtwSDR3NApRZm9VV3BnZU93MDZyYTluRHdzV3VhMUZIaHlKZmxOanR1UStTQ2VoN2pNWVVROFhXUmRtdUdvMVFPSDlyN0MrCi82L1JhMlZIQWdNQkFBRUNnZ0VCQUlyTlVFUnJSM2ZmK3IraGhJRS93ekZhbGNUMUZWaDh3aXpUWXJQcnZCMFkKYlZvcVJzZ2xUVTdxTjkvM3dmc2dzdEROZk5IQ1pySEJOR0drK0orMDZMV2tnakhycjdXeFBUaE16ZDRvUGN4RwpRdTBMOGE5ZVlBMXJwY3NOOVc5Um5JU3BRSEk4aTkxM0V6Z0RoOWk2WCt0bFQyNjNNK0JYaDhlM1Z5cDNSTmhpCjZZUTQwcWJsNlQ0TUlyLzRSMGJmcFExZWVMNVNnbHB6Z1d6ZGs4WGtmc0E5YnRiU1RoMjZKRlBPUU1tMm5adkcKbjBlZm85TDZtaktwRW9rRWpTY1hWYTRZNHJaREZFYTVIbkpUSDBHblByQzU1cDhBb3BFN1c1M2RDT3lxd29CcQo4SWtZb2grcm1qTUZrOGc5VlRVYlcwVE9YVTFSY1E1Z0gxWS9jam5uVTRrQ2dZRUE4amw5ZEQyN2JaQ2ZaTW9jCjJYRThiYkJTaFVXTjRvaklKc1lHY2xyTjJDUEtUNmExaVhvS3BrTXdGNUdsODEzQURGR1pTbWtUSUFVQXRXQU8KNzZCcEpGUlVCZ1hmUXhSU0gyS1RaRldxbE5yekZPQjNsT3h2bFJ1amw5eE9ueStyWUhJWC9BOWNqQlp3a2orSAo3MDZRTExvS1ZFL2lMYy9DMlI5VzRLRVI3R3NDZ1lFQXhWd3FyM1JnUXhHUmpueG1zbDZtUW5DQ3k2MXFoUzUxCkJicDJzWldraFNTV0w0YzFDY0NDMnZ2ektPSmJkZ2NZQU43L05sTHgzWjlCZUFjTVZMUEVoc2NPalB6YUlneEMKczJ2UkdwQUFtYnRjWi9MVlpKaERWTjIrSHowRHhnRUtCa1JzQU5XTG51cGRoUWJBdlZuTkVsY29YVlo1cC9qcwp3U1BCelFoSklaVUNnWUJqTUlHY0dTOW9SWUhRRHlmVEx4aVV2bEI4ZktnR2JRYXhRZ1FmemVsZktnRE5yekhGCnN6RXJOblk2SUkxNVpCbWhzY1I1QVNBd3kzdW55a2N6ZjFldTVjMW1qZjhJQkFsQkN1ZmFmVzRWK0xiMEJKdFQKWTZLcHg2Q3RMaTBQNk1CZ0JUaW5JazgrbW0zTXBiRnZvSmRQaVh0elhTYjhwWWhmeXdLVGg4SEVNd0tCZ1FDUwpvR0VPTFpYKy9pUjRDYkI2d0pzaExWbmZYSjJSQ096a0xwNVVYV3IzaURFVWFvMWJDMjJzcUJjRnZ2WllmL2l6ClhQbWJNSkNGS1BhSTZDT2ZJbGZXRWptYlFaZ0dSN21lZDNISkhFZDE3NTg5azBvN0RHeXB0bnl6MUs3akFvNmkKRFY5NFZ5NytCLzBuQWRkY1ZrVm5aTjJXU3RMam1xcTY2NGZtZmt0bTZRS0JnQzBsMk5OVlFWK2N0OFFRRFpINQpBRFIrSGM3Qk0wNDhURGhNTmhoR3JHc2tWNngwMCtMZTdISGdpT3h2NXJudkNlTlY2M001YUZHdFVWbllTN1VoCkE1NndaNVlZeFFnQ0xzNi9PRmZhK3NiTngrSjdnSjRjNXdMZVlJMXVPMTlzZHBHa2VHZ25vK3dXVmxDSzFCbW0KRGM0TXA2STRiUTVtdy93YVpLQnpjRTJLCi0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K" - badCrt := "ASD" - badKey := "ASD" - appRole := "ASD" - appSecret := "ASD" - endpoint := "ASD" - type args struct { - ctx context.Context - clientSet K8sClientI - ns string - encryptionCfg *models.EncryptionConfiguration - kesConfigurationSecretName string - kesClientCertSecretName string - tenantName string - mockDeleteSecret func(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error - mockCreateSecret func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) - } - tests := []struct { - name string - args args - want *v1.LocalObjectReference - want1 *miniov2.LocalCertificateReference - wantErr bool - }{ - { - name: "error decoding the client certificate", - args: args{ - ctx: context.Background(), - clientSet: k8sClient, - encryptionCfg: &models.EncryptionConfiguration{ - MinioMtls: &models.KeyPairConfiguration{ - Crt: &badCrt, - Key: &badKey, - }, - }, - ns: "default", - kesConfigurationSecretName: "test-secret", - kesClientCertSecretName: "test-client-secret", - tenantName: "test", - mockDeleteSecret: func(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error { - return nil - }, - }, - want: nil, - want1: nil, - wantErr: true, - }, - { - name: "error because of malformed decoded certificate", - args: args{ - ctx: context.Background(), - clientSet: k8sClient, - encryptionCfg: &models.EncryptionConfiguration{ - MinioMtls: &models.KeyPairConfiguration{ - Crt: &key, // will cause an error because we are passing a private key as the public key - Key: &key, - }, - }, - ns: "default", - kesConfigurationSecretName: "test-secret", - kesClientCertSecretName: "test-client-secret", - tenantName: "test", - mockDeleteSecret: func(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error { - return nil - }, - }, - want: nil, - want1: nil, - wantErr: true, - }, - { - name: "error because of malformed decoded certificate", - args: args{ - ctx: context.Background(), - clientSet: k8sClient, - encryptionCfg: &models.EncryptionConfiguration{ - MinioMtls: &models.KeyPairConfiguration{ - Crt: &crt, - Key: &key, - }, - KmsMtls: &models.EncryptionConfigurationAO1KmsMtls{ - Ca: crt, - Crt: crt, - Key: key, - }, - Vault: &models.VaultConfiguration{ - Approle: &models.VaultConfigurationApprole{ - Engine: "", - ID: &appRole, - Retry: 0, - Secret: &appSecret, - }, - Endpoint: &endpoint, - Engine: "", - Namespace: "", - Prefix: "", - Status: nil, - }, - }, - ns: "default", - kesConfigurationSecretName: "test-secret", - kesClientCertSecretName: "test-client-secret", - tenantName: "test", - mockDeleteSecret: func(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error { - return nil - }, - mockCreateSecret: func(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) { - return &v1.Secret{}, nil - }, - }, - want: &v1.LocalObjectReference{ - Name: "test-secret", - }, - want1: &miniov2.LocalCertificateReference{ - Name: "test-client-secret", - }, - wantErr: false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - k8sClientDeleteSecretMock = tt.args.mockDeleteSecret - k8sClientCreateSecretMock = tt.args.mockCreateSecret - got, got1, err := createOrReplaceKesConfigurationSecrets(tt.args.ctx, tt.args.clientSet, tt.args.ns, tt.args.encryptionCfg, tt.args.kesConfigurationSecretName, tt.args.kesClientCertSecretName, tt.args.tenantName) - if (err != nil) != tt.wantErr { - t.Errorf("createOrReplaceKesConfigurationSecrets() error = %v, wantErr %v", err, tt.wantErr) - return - } - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("createOrReplaceKesConfigurationSecrets() got = %v, want %v", got, tt.want) - } - if !reflect.DeepEqual(got1, tt.want1) { - t.Errorf("createOrReplaceKesConfigurationSecrets() got1 = %v, want %v", got1, tt.want1) - } - }) - } -} diff --git a/operatorapi/tenants_test.go b/operatorapi/tenants_test.go deleted file mode 100644 index 4edd0310a..000000000 --- a/operatorapi/tenants_test.go +++ /dev/null @@ -1,1845 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "bytes" - "context" - "encoding/json" - "errors" - "io" - "io/ioutil" - "net/http" - "reflect" - "testing" - "time" - - "github.com/go-openapi/swag" - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations/operator_api" - xhttp "github.com/minio/console/pkg/http" - miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - "github.com/stretchr/testify/assert" - corev1 "k8s.io/api/core/v1" - k8sErrors "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/kubernetes/fake" -) - -var ( - opClientTenantDeleteMock func(ctx context.Context, namespace string, tenantName string, options metav1.DeleteOptions) error - opClientTenantGetMock func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) - opClientTenantPatchMock func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) - opClientTenantUpdateMock func(ctx context.Context, tenant *miniov2.Tenant, opts metav1.UpdateOptions) (*miniov2.Tenant, error) -) - -var ( - opClientTenantListMock func(ctx context.Context, namespace string, opts metav1.ListOptions) (*miniov2.TenantList, error) - httpClientGetMock func(url string) (resp *http.Response, err error) - httpClientPostMock func(url, contentType string, body io.Reader) (resp *http.Response, err error) - httpClientDoMock func(req *http.Request) (*http.Response, error) -) - -// mock function of TenantDelete() -func (ac opClientMock) TenantDelete(ctx context.Context, namespace string, tenantName string, options metav1.DeleteOptions) error { - return opClientTenantDeleteMock(ctx, namespace, tenantName, options) -} - -// mock function of TenantGet() -func (ac opClientMock) TenantGet(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return opClientTenantGetMock(ctx, namespace, tenantName, options) -} - -// mock function of TenantPatch() -func (ac opClientMock) TenantPatch(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) { - return opClientTenantPatchMock(ctx, namespace, tenantName, pt, data, options) -} - -// mock function of TenantUpdate() -func (ac opClientMock) TenantUpdate(ctx context.Context, tenant *miniov2.Tenant, opts metav1.UpdateOptions) (*miniov2.Tenant, error) { - return opClientTenantUpdateMock(ctx, tenant, opts) -} - -// mock function of TenantList() -func (ac opClientMock) TenantList(ctx context.Context, namespace string, opts metav1.ListOptions) (*miniov2.TenantList, error) { - return opClientTenantListMock(ctx, namespace, opts) -} - -// mock function of get() -func (h httpClientMock) Get(url string) (resp *http.Response, err error) { - return httpClientGetMock(url) -} - -// mock function of post() -func (h httpClientMock) Post(url, contentType string, body io.Reader) (resp *http.Response, err error) { - return httpClientPostMock(url, contentType, body) -} - -// mock function of Do() -func (h httpClientMock) Do(req *http.Request) (*http.Response, error) { - return httpClientDoMock(req) -} - -func Test_TenantInfoTenantAdminClient(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - kClient := k8sClientMock{} - type args struct { - ctx context.Context - client K8sClientI - tenant miniov2.Tenant - serviceURL string - } - tests := []struct { - name string - args args - wantErr bool - mockGetSecret func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) - mockGetService func(ctx context.Context, namespace, serviceName string, opts metav1.GetOptions) (*corev1.Service, error) - }{ - { - name: "Return Tenant Admin, no errors using legacy credentials", - args: args{ - ctx: ctx, - client: kClient, - tenant: miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "default", - Name: "tenant-1", - }, - Spec: miniov2.TenantSpec{ - CredsSecret: &corev1.LocalObjectReference{ - Name: "secret-name", - }, - }, - }, - serviceURL: "http://service-1.default.svc.cluster.local:80", - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - vals := make(map[string][]byte) - vals["secretkey"] = []byte("secret") - vals["accesskey"] = []byte("access") - sec := &corev1.Secret{ - Data: vals, - } - return sec, nil - }, - mockGetService: func(ctx context.Context, namespace, serviceName string, opts metav1.GetOptions) (*corev1.Service, error) { - serv := &corev1.Service{ - Spec: corev1.ServiceSpec{ - ClusterIP: "10.1.1.2", - }, - } - return serv, nil - }, - wantErr: false, - }, - { - name: "Return Tenant Admin, no errors using credentials from configuration file", - args: args{ - ctx: ctx, - client: kClient, - tenant: miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "default", - Name: "tenant-1", - }, - Spec: miniov2.TenantSpec{ - CredsSecret: &corev1.LocalObjectReference{ - Name: "secret-name", - }, - Configuration: &corev1.LocalObjectReference{ - Name: "tenant-configuration", - }, - }, - }, - serviceURL: "http://service-1.default.svc.cluster.local:80", - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - vals := make(map[string][]byte) - vals["config.env"] = []byte(` -export MINIO_ROOT_USER=minio -export MINIO_ROOT_PASSWORD=minio123 -`) - sec := &corev1.Secret{ - Data: vals, - } - return sec, nil - }, - mockGetService: func(ctx context.Context, namespace, serviceName string, opts metav1.GetOptions) (*corev1.Service, error) { - serv := &corev1.Service{ - Spec: corev1.ServiceSpec{ - ClusterIP: "10.1.1.2", - }, - } - return serv, nil - }, - wantErr: false, - }, - { - name: "Return Tenant Admin, no errors using credentials from configuration file 2", - args: args{ - ctx: ctx, - client: kClient, - tenant: miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "default", - Name: "tenant-1", - }, - Spec: miniov2.TenantSpec{ - CredsSecret: &corev1.LocalObjectReference{ - Name: "secret-name", - }, - Configuration: &corev1.LocalObjectReference{ - Name: "tenant-configuration", - }, - }, - }, - serviceURL: "http://service-1.default.svc.cluster.local:80", - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - vals := make(map[string][]byte) - vals["config.env"] = []byte(` -export MINIO_ACCESS_KEY=minio -export MINIO_SECRET_KEY=minio123 -`) - sec := &corev1.Secret{ - Data: vals, - } - return sec, nil - }, - mockGetService: func(ctx context.Context, namespace, serviceName string, opts metav1.GetOptions) (*corev1.Service, error) { - serv := &corev1.Service{ - Spec: corev1.ServiceSpec{ - ClusterIP: "10.1.1.2", - }, - } - return serv, nil - }, - wantErr: false, - }, - { - name: "Access key not stored on secrets", - args: args{ - ctx: ctx, - client: kClient, - tenant: miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "default", - Name: "tenant-1", - }, - }, - serviceURL: "http://service-1.default.svc.cluster.local:80", - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - vals := make(map[string][]byte) - vals["secretkey"] = []byte("secret") - sec := &corev1.Secret{ - Data: vals, - } - return sec, nil - }, - mockGetService: func(ctx context.Context, namespace, serviceName string, opts metav1.GetOptions) (*corev1.Service, error) { - serv := &corev1.Service{ - Spec: corev1.ServiceSpec{ - ClusterIP: "10.1.1.2", - }, - } - return serv, nil - }, - wantErr: true, - }, - { - name: "Secret key not stored on secrets", - args: args{ - ctx: ctx, - client: kClient, - tenant: miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "default", - Name: "tenant-1", - }, - }, - serviceURL: "http://service-1.default.svc.cluster.local:80", - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - vals := make(map[string][]byte) - vals["accesskey"] = []byte("access") - sec := &corev1.Secret{ - Data: vals, - } - return sec, nil - }, - mockGetService: func(ctx context.Context, namespace, serviceName string, opts metav1.GetOptions) (*corev1.Service, error) { - serv := &corev1.Service{ - Spec: corev1.ServiceSpec{ - ClusterIP: "10.1.1.2", - }, - } - return serv, nil - }, - wantErr: true, - }, - { - name: "Handle error on getService", - args: args{ - ctx: ctx, - client: kClient, - tenant: miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "default", - Name: "tenant-1", - }, - }, - serviceURL: "http://service-1.default.svc.cluster.local:80", - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - vals := make(map[string][]byte) - vals["accesskey"] = []byte("access") - vals["secretkey"] = []byte("secret") - sec := &corev1.Secret{ - Data: vals, - } - return sec, nil - }, - mockGetService: func(ctx context.Context, namespace, serviceName string, opts metav1.GetOptions) (*corev1.Service, error) { - return nil, errors.New("error") - }, - wantErr: true, - }, - { - name: "Handle error on getSecret", - args: args{ - ctx: ctx, - client: kClient, - tenant: miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "default", - Name: "tenant-1", - }, - }, - serviceURL: "http://service-1.default.svc.cluster.local:80", - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return nil, errors.New("error") - }, - mockGetService: func(ctx context.Context, namespace, serviceName string, opts metav1.GetOptions) (*corev1.Service, error) { - serv := &corev1.Service{ - Spec: corev1.ServiceSpec{ - ClusterIP: "10.1.1.2", - }, - } - return serv, nil - }, - wantErr: true, - }, - } - for _, tt := range tests { - k8sclientGetSecretMock = tt.mockGetSecret - k8sclientGetServiceMock = tt.mockGetService - t.Run(tt.name, func(t *testing.T) { - got, err := getTenantAdminClient(tt.args.ctx, tt.args.client, &tt.args.tenant, tt.args.serviceURL) - if err != nil { - if tt.wantErr { - return - } - t.Errorf("getTenantAdminClient() error = %v, wantErr %v", err, tt.wantErr) - } - if got == nil { - t.Errorf("getTenantAdminClient() expected type: *madmin.AdminClient, got: nil") - } - }) - } -} - -func Test_TenantInfo(t *testing.T) { - testTimeStamp := metav1.Now() - type args struct { - minioTenant *miniov2.Tenant - } - tests := []struct { - name string - args args - want *models.Tenant - }{ - { - name: "Get tenant Info", - args: args{ - minioTenant: &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - CreationTimestamp: testTimeStamp, - Name: "tenant1", - Namespace: "minio-ns", - }, - Spec: miniov2.TenantSpec{ - Pools: []miniov2.Pool{ - { - Name: "pool1", - Servers: int32(2), - VolumesPerServer: 4, - VolumeClaimTemplate: &corev1.PersistentVolumeClaim{ - Spec: corev1.PersistentVolumeClaimSpec{ - Resources: corev1.ResourceRequirements{ - Requests: map[corev1.ResourceName]resource.Quantity{ - corev1.ResourceStorage: resource.MustParse("1Mi"), - }, - }, - StorageClassName: swag.String("standard"), - }, - }, - RuntimeClassName: swag.String(""), - }, - }, - - Image: "minio/minio:RELEASE.2020-06-14T18-32-17Z", - }, - Status: miniov2.TenantStatus{ - CurrentState: "ready", - }, - }, - }, - want: &models.Tenant{ - CreationDate: testTimeStamp.Format(time.RFC3339), - Name: "tenant1", - TotalSize: int64(8388608), - CurrentState: "ready", - Pools: []*models.Pool{ - { - Name: "pool1", - SecurityContext: &models.SecurityContext{ - RunAsGroup: nil, - RunAsNonRoot: nil, - RunAsUser: nil, - }, - Servers: swag.Int64(int64(2)), - VolumesPerServer: swag.Int32(4), - VolumeConfiguration: &models.PoolVolumeConfiguration{ - StorageClassName: "standard", - Size: swag.Int64(1024 * 1024), - }, - }, - }, - Namespace: "minio-ns", - Image: "minio/minio:RELEASE.2020-06-14T18-32-17Z", - EnablePrometheus: false, - }, - }, - { - // Description if DeletionTimeStamp is present, value should be returned as string - // If Prometheus annotations are present, EnablePrometheus should be returned as true - // All three annotations should be defined to consider Prometheus enabled - name: "Get tenant Info w DeletionTimeStamp and Prometheus", - args: args{ - minioTenant: &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - CreationTimestamp: testTimeStamp, - Name: "tenant1", - Namespace: "minio-ns", - DeletionTimestamp: &testTimeStamp, - Annotations: map[string]string{ - prometheusPath: "some/path", - prometheusPort: "other/path", - prometheusScrape: "other/path", - }, - }, - Spec: miniov2.TenantSpec{ - Pools: []miniov2.Pool{ - { - Name: "pool1", - Servers: int32(2), - VolumesPerServer: 4, - VolumeClaimTemplate: &corev1.PersistentVolumeClaim{ - Spec: corev1.PersistentVolumeClaimSpec{ - Resources: corev1.ResourceRequirements{ - Requests: map[corev1.ResourceName]resource.Quantity{ - corev1.ResourceStorage: resource.MustParse("1Mi"), - }, - }, - StorageClassName: swag.String("standard"), - }, - }, - RuntimeClassName: swag.String(""), - }, - }, - Image: "minio/minio:RELEASE.2020-06-14T18-32-17Z", - }, - Status: miniov2.TenantStatus{ - CurrentState: "ready", - }, - }, - }, - want: &models.Tenant{ - CreationDate: testTimeStamp.Format(time.RFC3339), - DeletionDate: testTimeStamp.Format(time.RFC3339), - Name: "tenant1", - TotalSize: int64(8388608), - CurrentState: "ready", - Pools: []*models.Pool{ - { - Name: "pool1", - SecurityContext: &models.SecurityContext{ - RunAsGroup: nil, - RunAsNonRoot: nil, - RunAsUser: nil, - }, - Servers: swag.Int64(int64(2)), - VolumesPerServer: swag.Int32(4), - VolumeConfiguration: &models.PoolVolumeConfiguration{ - StorageClassName: "standard", - Size: swag.Int64(1024 * 1024), - }, - }, - }, - Namespace: "minio-ns", - Image: "minio/minio:RELEASE.2020-06-14T18-32-17Z", - EnablePrometheus: true, - }, - }, - { - // If Prometheus annotations are present, EnablePrometheus should be returned as true - // All three annotations should be defined to consider Prometheus enabled - name: "Get tenant Info, not all Prometheus annotations", - args: args{ - minioTenant: &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - CreationTimestamp: testTimeStamp, - Name: "tenant1", - Namespace: "minio-ns", - Annotations: map[string]string{ - prometheusPath: "some/path", - prometheusScrape: "other/path", - }, - }, - Spec: miniov2.TenantSpec{ - Pools: []miniov2.Pool{}, - Image: "minio/minio:RELEASE.2020-06-14T18-32-17Z", - }, - Status: miniov2.TenantStatus{ - CurrentState: "ready", - }, - }, - }, - want: &models.Tenant{ - CreationDate: testTimeStamp.Format(time.RFC3339), - Name: "tenant1", - CurrentState: "ready", - Namespace: "minio-ns", - Image: "minio/minio:RELEASE.2020-06-14T18-32-17Z", - EnablePrometheus: false, - }, - }, - { - // If console image is set, it should be returned on tenant info - name: "Get tenant Info, Console image set", - args: args{ - minioTenant: &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - CreationTimestamp: testTimeStamp, - Name: "tenant1", - Namespace: "minio-ns", - Annotations: map[string]string{ - prometheusPath: "some/path", - prometheusScrape: "other/path", - }, - }, - Spec: miniov2.TenantSpec{ - Pools: []miniov2.Pool{}, - Image: "minio/minio:RELEASE.2020-06-14T18-32-17Z", - }, - Status: miniov2.TenantStatus{ - CurrentState: "ready", - }, - }, - }, - want: &models.Tenant{ - CreationDate: testTimeStamp.Format(time.RFC3339), - Name: "tenant1", - CurrentState: "ready", - Namespace: "minio-ns", - Image: "minio/minio:RELEASE.2020-06-14T18-32-17Z", - EnablePrometheus: false, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got := getTenantInfo(tt.args.minioTenant) - if !reflect.DeepEqual(got, tt.want) { - ji, _ := json.Marshal(got) - vi, _ := json.Marshal(tt.want) - t.Errorf("got %s want %s", ji, vi) - } - }) - } -} - -func Test_deleteTenantAction(t *testing.T) { - opClient := opClientMock{} - type args struct { - ctx context.Context - operatorClient OperatorClientI - tenant *miniov2.Tenant - deletePvcs bool - objs []runtime.Object - mockTenantDelete func(ctx context.Context, namespace string, tenantName string, options metav1.DeleteOptions) error - } - tests := []struct { - name string - args args - wantErr bool - }{ - { - name: "Success", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - tenant: &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Name: "default", - Namespace: "minio-tenant", - }, - }, - deletePvcs: false, - mockTenantDelete: func(ctx context.Context, namespace string, tenantName string, options metav1.DeleteOptions) error { - return nil - }, - }, - wantErr: false, - }, - { - name: "Error", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - tenant: &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Name: "default", - Namespace: "minio-tenant", - }, - }, - deletePvcs: false, - mockTenantDelete: func(ctx context.Context, namespace string, tenantName string, options metav1.DeleteOptions) error { - return errors.New("something happened") - }, - }, - wantErr: true, - }, - { - // Delete only PVCs of the defined tenant on the specific namespace - name: "Delete PVCs on Tenant Deletion", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - tenant: &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Name: "tenant1", - Namespace: "minio-tenant", - }, - }, - deletePvcs: true, - objs: []runtime.Object{ - &corev1.PersistentVolumeClaim{ - ObjectMeta: metav1.ObjectMeta{ - Name: "PVC1", - Namespace: "minio-tenant", - Labels: map[string]string{ - miniov2.TenantLabel: "tenant1", - miniov2.PoolLabel: "pool-1", - }, - }, - }, - }, - mockTenantDelete: func(ctx context.Context, namespace string, tenantName string, options metav1.DeleteOptions) error { - return nil - }, - }, - wantErr: false, - }, - { - // Do not delete underlying pvcs - name: "Don't Delete PVCs on Tenant Deletion", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - tenant: &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Name: "tenant1", - Namespace: "minio-tenant", - }, - }, - deletePvcs: false, - objs: []runtime.Object{ - &corev1.PersistentVolumeClaim{ - ObjectMeta: metav1.ObjectMeta{ - Name: "PVC1", - Namespace: "minio-tenant", - Labels: map[string]string{ - miniov2.TenantLabel: "tenant1", - miniov2.PoolLabel: "pool-1", - }, - }, - }, - }, - mockTenantDelete: func(ctx context.Context, namespace string, tenantName string, options metav1.DeleteOptions) error { - return nil - }, - }, - wantErr: false, - }, - { - // If error is different than NotFound, PVC deletion should not continue - name: "Don't delete pvcs if error Deleting Tenant, return", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - tenant: &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Name: "tenant1", - Namespace: "minio-tenant", - }, - }, - deletePvcs: true, - objs: []runtime.Object{ - &corev1.PersistentVolumeClaim{ - ObjectMeta: metav1.ObjectMeta{ - Name: "PVC1", - Namespace: "minio-tenant", - Labels: map[string]string{ - miniov2.TenantLabel: "tenant1", - miniov2.PoolLabel: "pool-1", - }, - }, - }, - }, - mockTenantDelete: func(ctx context.Context, namespace string, tenantName string, options metav1.DeleteOptions) error { - return errors.New("error returned") - }, - }, - wantErr: true, - }, - { - // If error is NotFound while trying to Delete Tenant, PVC deletion should continue - name: "Delete pvcs if tenant not found", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - tenant: &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Name: "tenant1", - Namespace: "minio-tenant", - }, - }, - deletePvcs: true, - objs: []runtime.Object{ - &corev1.PersistentVolumeClaim{ - ObjectMeta: metav1.ObjectMeta{ - Name: "PVC1", - Namespace: "minio-tenant", - Labels: map[string]string{ - miniov2.TenantLabel: "tenant1", - miniov2.PoolLabel: "pool-1", - }, - }, - }, - }, - mockTenantDelete: func(ctx context.Context, namespace string, tenantName string, options metav1.DeleteOptions) error { - return k8sErrors.NewNotFound(schema.GroupResource{}, "tenant1") - }, - }, - wantErr: false, - }, - { - // If error is NotFound while trying to Delete Tenant and pvcdeletion=false, - // error should be returned - name: "Don't delete pvcs and return error if tenant not found", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - tenant: &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Name: "tenant1", - Namespace: "minio-tenant", - }, - }, - deletePvcs: false, - objs: []runtime.Object{ - &corev1.PersistentVolumeClaim{ - ObjectMeta: metav1.ObjectMeta{ - Name: "PVC1", - Namespace: "minio-tenant", - Labels: map[string]string{ - miniov2.TenantLabel: "tenant1", - miniov2.PoolLabel: "pool-1", - }, - }, - }, - }, - mockTenantDelete: func(ctx context.Context, namespace string, tenantName string, options metav1.DeleteOptions) error { - return k8sErrors.NewNotFound(schema.GroupResource{}, "tenant1") - }, - }, - wantErr: true, - }, - } - for _, tt := range tests { - opClientTenantDeleteMock = tt.args.mockTenantDelete - kubeClient := fake.NewSimpleClientset(tt.args.objs...) - t.Run(tt.name, func(t *testing.T) { - if err := deleteTenantAction(tt.args.ctx, tt.args.operatorClient, kubeClient.CoreV1(), tt.args.tenant, tt.args.deletePvcs); (err != nil) != tt.wantErr { - t.Errorf("deleteTenantAction() error = %v, wantErr %v", err, tt.wantErr) - } - }) - } -} - -func Test_TenantAddPool(t *testing.T) { - opClient := opClientMock{} - - type args struct { - ctx context.Context - operatorClient OperatorClientI - nameSpace string - mockTenantPatch func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) - mockTenantGet func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) - params operator_api.TenantAddPoolParams - } - tests := []struct { - name string - args args - wantErr bool - }{ - { - name: "Add pool, no errors", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - nameSpace: "default", - mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - params: operator_api.TenantAddPoolParams{ - Body: &models.Pool{ - Name: "pool-1", - Servers: swag.Int64(int64(4)), - VolumeConfiguration: &models.PoolVolumeConfiguration{ - Size: swag.Int64(2147483648), - StorageClassName: "standard", - }, - VolumesPerServer: swag.Int32(4), - }, - }, - }, - wantErr: false, - }, - { - name: "Add pool, error size", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - nameSpace: "default", - mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - params: operator_api.TenantAddPoolParams{ - Body: &models.Pool{ - Name: "pool-1", - Servers: swag.Int64(int64(4)), - VolumeConfiguration: &models.PoolVolumeConfiguration{ - Size: swag.Int64(0), - StorageClassName: "standard", - }, - VolumesPerServer: swag.Int32(4), - }, - }, - }, - wantErr: true, - }, - { - name: "Add pool, error servers negative", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - nameSpace: "default", - mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - params: operator_api.TenantAddPoolParams{ - Body: &models.Pool{ - Name: "pool-1", - Servers: swag.Int64(int64(-1)), - VolumeConfiguration: &models.PoolVolumeConfiguration{ - Size: swag.Int64(2147483648), - StorageClassName: "standard", - }, - VolumesPerServer: swag.Int32(4), - }, - }, - }, - wantErr: true, - }, - { - name: "Add pool, error volumes per server negative", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - nameSpace: "default", - mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - params: operator_api.TenantAddPoolParams{ - Body: &models.Pool{ - Name: "pool-1", - Servers: swag.Int64(int64(4)), - VolumeConfiguration: &models.PoolVolumeConfiguration{ - Size: swag.Int64(2147483648), - StorageClassName: "standard", - }, - VolumesPerServer: swag.Int32(-1), - }, - }, - }, - wantErr: true, - }, - { - name: "Error on patch, handle error", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - nameSpace: "default", - mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) { - return nil, errors.New("errors") - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - params: operator_api.TenantAddPoolParams{ - Body: &models.Pool{ - Name: "pool-1", - Servers: swag.Int64(int64(4)), - }, - }, - }, - wantErr: true, - }, - { - name: "Error on get, handle error", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - nameSpace: "default", - mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) { - return nil, errors.New("errors") - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return nil, errors.New("errors") - }, - params: operator_api.TenantAddPoolParams{ - Body: &models.Pool{ - Name: "pool-1", - Servers: swag.Int64(int64(4)), - }, - }, - }, - wantErr: true, - }, - } - for _, tt := range tests { - opClientTenantGetMock = tt.args.mockTenantGet - opClientTenantPatchMock = tt.args.mockTenantPatch - t.Run(tt.name, func(t *testing.T) { - if err := addTenantPool(tt.args.ctx, tt.args.operatorClient, tt.args.params); (err != nil) != tt.wantErr { - t.Errorf("addTenantPool() error = %v, wantErr %v", err, tt.wantErr) - } - }) - } -} - -func Test_UpdateTenantAction(t *testing.T) { - opClient := opClientMock{} - httpClientM := httpClientMock{} - - type args struct { - ctx context.Context - operatorClient OperatorClientI - httpCl xhttp.ClientI - nameSpace string - tenantName string - mockTenantPatch func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) - mockTenantGet func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) - mockHTTPClientGet func(url string) (resp *http.Response, err error) - params operator_api.UpdateTenantParams - } - tests := []struct { - name string - args args - objs []runtime.Object - wantErr bool - }{ - { - name: "Update minio version no errors", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - httpCl: httpClientM, - nameSpace: "default", - tenantName: "minio-tenant", - mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - mockHTTPClientGet: func(url string) (resp *http.Response, err error) { - return &http.Response{}, nil - }, - params: operator_api.UpdateTenantParams{ - Body: &models.UpdateTenantRequest{ - Image: "minio/minio:RELEASE.2023-01-06T18-11-18Z", - }, - }, - }, - wantErr: false, - }, - { - name: "Error occurs getting minioTenant", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - httpCl: httpClientM, - nameSpace: "default", - tenantName: "minio-tenant", - mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return nil, errors.New("error-get") - }, - mockHTTPClientGet: func(url string) (resp *http.Response, err error) { - return &http.Response{}, nil - }, - params: operator_api.UpdateTenantParams{ - Body: &models.UpdateTenantRequest{ - Image: "minio/minio:RELEASE.2023-01-06T18-11-18Z", - }, - }, - }, - wantErr: true, - }, - { - name: "Error occurs patching minioTenant", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - httpCl: httpClientM, - nameSpace: "default", - tenantName: "minio-tenant", - mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) { - return nil, errors.New("error-get") - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - mockHTTPClientGet: func(url string) (resp *http.Response, err error) { - return &http.Response{}, nil - }, - params: operator_api.UpdateTenantParams{ - Tenant: "minio-tenant", - Body: &models.UpdateTenantRequest{ - Image: "minio/minio:RELEASE.2023-01-06T18-11-18Z", - }, - }, - }, - wantErr: true, - }, - { - name: "Empty image should patch correctly with latest image", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - httpCl: httpClientM, - nameSpace: "default", - tenantName: "minio-tenant", - mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - mockHTTPClientGet: func(url string) (resp *http.Response, err error) { - r := ioutil.NopCloser(bytes.NewReader([]byte(`./minio.RELEASE.2020-06-18T02-23-35Z"`))) - return &http.Response{ - Body: r, - }, nil - }, - params: operator_api.UpdateTenantParams{ - Tenant: "minio-tenant", - Body: &models.UpdateTenantRequest{ - Image: "", - }, - }, - }, - wantErr: false, - }, - { - name: "Empty image input Error retrieving latest image, nothing happens", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - httpCl: httpClientM, - nameSpace: "default", - tenantName: "minio-tenant", - mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - mockHTTPClientGet: func(url string) (resp *http.Response, err error) { - return nil, errors.New("error") - }, - params: operator_api.UpdateTenantParams{ - Tenant: "minio-tenant", - Body: &models.UpdateTenantRequest{ - Image: "", - }, - }, - }, - wantErr: false, - }, - { - name: "Update minio image pull secrets no errors", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - httpCl: httpClientM, - nameSpace: "default", - tenantName: "minio-tenant", - mockTenantPatch: func(ctx context.Context, namespace string, tenantName string, pt types.PatchType, data []byte, options metav1.PatchOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - mockHTTPClientGet: func(url string) (resp *http.Response, err error) { - return nil, errors.New("use default minio") - }, - params: operator_api.UpdateTenantParams{ - Body: &models.UpdateTenantRequest{ - ImagePullSecret: "minio-regcred", - }, - }, - }, - wantErr: false, - }, - } - for _, tt := range tests { - opClientTenantGetMock = tt.args.mockTenantGet - opClientTenantPatchMock = tt.args.mockTenantPatch - httpClientGetMock = tt.args.mockHTTPClientGet - cnsClient := k8sClientMock{} - t.Run(tt.name, func(t *testing.T) { - if err := updateTenantAction(tt.args.ctx, tt.args.operatorClient, cnsClient, tt.args.httpCl, tt.args.nameSpace, tt.args.params); (err != nil) != tt.wantErr { - t.Errorf("updateTenantAction() error = %v, wantErr %v", err, tt.wantErr) - } - }) - } -} - -func Test_UpdateDomainsResponse(t *testing.T) { - opClient := opClientMock{} - - type args struct { - ctx context.Context - operatorClient OperatorClientI - nameSpace string - tenantName string - mockTenantUpdate func(ctx context.Context, tenant *miniov2.Tenant, options metav1.UpdateOptions) (*miniov2.Tenant, error) - mockTenantGet func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) - domains *models.DomainsConfiguration - } - tests := []struct { - name string - args args - objs []runtime.Object - wantErr bool - }{ - { - name: "Update console & minio domains OK", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - nameSpace: "default", - tenantName: "minio-tenant", - mockTenantUpdate: func(ctx context.Context, tenant *miniov2.Tenant, options metav1.UpdateOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - domains: &models.DomainsConfiguration{ - Console: "http://console.min.io", - Minio: []string{"http://domain1.min.io", "http://domain2.min.io", "http://domain3.min.io"}, - }, - }, - wantErr: false, - }, - { - name: "Error occurs getting minioTenant", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - nameSpace: "default", - tenantName: "minio-tenant", - mockTenantUpdate: func(ctx context.Context, tenant *miniov2.Tenant, options metav1.UpdateOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return nil, errors.New("error-getting-tenant-info") - }, - domains: &models.DomainsConfiguration{ - Console: "http://console.min.io", - Minio: []string{"http://domain1.min.io", "http://domain2.min.io", "http://domain3.min.io"}, - }, - }, - wantErr: true, - }, - { - name: "Tenant already has domains", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - nameSpace: "default", - tenantName: "minio-tenant", - mockTenantUpdate: func(ctx context.Context, tenant *miniov2.Tenant, options metav1.UpdateOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - domains := miniov2.TenantDomains{ - Console: "http://onerandomdomain.min.io", - Minio: []string{ - "http://oneDomain.min.io", - "http://twoDomains.min.io", - }, - } - - features := miniov2.Features{ - Domains: &domains, - } - - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{Features: &features}, - }, nil - }, - domains: &models.DomainsConfiguration{ - Console: "http://console.min.io", - Minio: []string{"http://domain1.min.io", "http://domain2.min.io", "http://domain3.min.io"}, - }, - }, - wantErr: false, - }, - { - name: "Tenant features only have BucketDNS", - args: args{ - ctx: context.Background(), - operatorClient: opClient, - nameSpace: "default", - tenantName: "minio-tenant", - mockTenantUpdate: func(ctx context.Context, tenant *miniov2.Tenant, options metav1.UpdateOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{}, nil - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - features := miniov2.Features{ - BucketDNS: true, - } - - return &miniov2.Tenant{ - Spec: miniov2.TenantSpec{Features: &features}, - }, nil - }, - domains: &models.DomainsConfiguration{ - Console: "http://console.min.io", - Minio: []string{"http://domain1.min.io", "http://domain2.min.io", "http://domain3.min.io"}, - }, - }, - wantErr: false, - }, - } - for _, tt := range tests { - opClientTenantGetMock = tt.args.mockTenantGet - opClientTenantUpdateMock = tt.args.mockTenantUpdate - t.Run(tt.name, func(t *testing.T) { - if err := updateTenantDomains(tt.args.ctx, tt.args.operatorClient, tt.args.nameSpace, tt.args.tenantName, tt.args.domains); (err != nil) != tt.wantErr { - t.Errorf("updateTenantDomains() error = %v, wantErr %v", err, tt.wantErr) - } - }) - } -} - -func Test_parseTenantCertificates(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - kClient := k8sClientMock{} - type args struct { - ctx context.Context - clientSet K8sClientI - namespace string - secrets []*miniov2.LocalCertificateReference - } - tests := []struct { - name string - args args - want []*models.CertificateInfo - mockGetSecret func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) - wantErr bool - }{ - { - name: "empty secrets list", - args: args{ - ctx: ctx, - clientSet: kClient, - secrets: nil, - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return nil, nil - }, - want: nil, - wantErr: false, - }, - { - name: "error getting secret", - args: args{ - ctx: ctx, - clientSet: kClient, - secrets: []*miniov2.LocalCertificateReference{ - { - Name: "certificate-1", - }, - }, - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return nil, errors.New("error getting secret") - }, - want: nil, - wantErr: true, - }, - { - name: "error getting certificate because of missing public key", - args: args{ - ctx: ctx, - clientSet: kClient, - secrets: []*miniov2.LocalCertificateReference{ - { - Name: "certificate-1", - Type: "Opaque", - }, - }, - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - certificateSecret := &corev1.Secret{ - Data: map[string][]byte{ - "eaeaeae": []byte(` ------BEGIN CERTIFICATE----- -MIIBUDCCAQKgAwIBAgIRALdFZh8hLU348ho9wYzlZbAwBQYDK2VwMBIxEDAOBgNV -BAoTB0FjbWUgQ28wHhcNMjIwODE4MjAxMzUzWhcNMjMwODE4MjAxMzUzWjASMRAw -DgYDVQQKEwdBY21lIENvMCowBQYDK2VwAyEAct5c3dzzbNOTi+C62w7QHoSivEWD -MYAheDXZWHC55tGjbTBrMA4GA1UdDwEB/wQEAwIChDATBgNVHSUEDDAKBggrBgEF -BQcDATAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTs0At8sTSLCjiM24AZhxFY -a2CswjAUBgNVHREEDTALgglsb2NhbGhvc3QwBQYDK2VwA0EABan+d16CeN8UD+QF -a8HBhPAiOpaZeEF6+EqTlq9VfL3eSVd7CLRI+/KtY7ptwomuTeYzuV73adKdE9N2 -ZrJuAw== ------END CERTIFICATE----- - `), - }, - Type: "Opaque", - } - return certificateSecret, nil - }, - want: nil, - wantErr: true, - }, - { - name: "return certificate from existing secret", - args: args{ - ctx: ctx, - clientSet: kClient, - secrets: []*miniov2.LocalCertificateReference{ - { - Name: "certificate-1", - Type: "Opaque", - }, - }, - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - certificateSecret := &corev1.Secret{ - Data: map[string][]byte{ - "public.crt": []byte(` ------BEGIN CERTIFICATE----- -MIIBUDCCAQKgAwIBAgIRALdFZh8hLU348ho9wYzlZbAwBQYDK2VwMBIxEDAOBgNV -BAoTB0FjbWUgQ28wHhcNMjIwODE4MjAxMzUzWhcNMjMwODE4MjAxMzUzWjASMRAw -DgYDVQQKEwdBY21lIENvMCowBQYDK2VwAyEAct5c3dzzbNOTi+C62w7QHoSivEWD -MYAheDXZWHC55tGjbTBrMA4GA1UdDwEB/wQEAwIChDATBgNVHSUEDDAKBggrBgEF -BQcDATAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTs0At8sTSLCjiM24AZhxFY -a2CswjAUBgNVHREEDTALgglsb2NhbGhvc3QwBQYDK2VwA0EABan+d16CeN8UD+QF -a8HBhPAiOpaZeEF6+EqTlq9VfL3eSVd7CLRI+/KtY7ptwomuTeYzuV73adKdE9N2 -ZrJuAw== ------END CERTIFICATE----- - `), - }, - Type: "Opaque", - } - return certificateSecret, nil - }, - want: []*models.CertificateInfo{ - { - SerialNumber: "243609062983998893460787085129017550256", - Name: "certificate-1", - Expiry: "2023-08-18T20:13:53Z", - Domains: []string{"localhost"}, - }, - }, - wantErr: false, - }, - } - for _, tt := range tests { - k8sclientGetSecretMock = tt.mockGetSecret - t.Run(tt.name, func(t *testing.T) { - got, err := parseTenantCertificates(tt.args.ctx, tt.args.clientSet, tt.args.namespace, tt.args.secrets) - if (err != nil) != tt.wantErr { - t.Errorf("parseTenantCertificates(%v, %v, %v, %v)error = %v, wantErr %v", tt.args.ctx, tt.args.clientSet, tt.args.namespace, tt.args.secrets, err, tt.wantErr) - } - assert.Equalf(t, tt.want, got, "parseTenantCertificates(%v, %v, %v, %v)", tt.args.ctx, tt.args.clientSet, tt.args.namespace, tt.args.secrets) - }) - } -} - -func Test_getTenant(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - opClient := opClientMock{} - type args struct { - ctx context.Context - operatorClient OperatorClientI - namespace string - tenantName string - mockTenantGet func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) - } - tests := []struct { - name string - args args - want *miniov2.Tenant - wantErr bool - }{ - { - name: "error getting tenant information", - args: args{ - ctx: ctx, - operatorClient: opClient, - namespace: "default", - tenantName: "test", - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return nil, errors.New("error getting tenant information") - }, - }, - want: nil, - wantErr: true, - }, - { - name: "success getting tenant information", - args: args{ - ctx: ctx, - operatorClient: opClient, - namespace: "default", - tenantName: "test", - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test", - Namespace: "default", - }, - }, nil - }, - }, - want: &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test", - Namespace: "default", - }, - }, - wantErr: false, - }, - } - for _, tt := range tests { - opClientTenantGetMock = tt.args.mockTenantGet - t.Run(tt.name, func(t *testing.T) { - got, err := getTenant(tt.args.ctx, tt.args.operatorClient, tt.args.namespace, tt.args.tenantName) - if (err != nil) != tt.wantErr { - t.Errorf("getTenant(%v, %v, %v, %v)", tt.args.ctx, tt.args.operatorClient, tt.args.namespace, tt.args.tenantName) - } - assert.Equalf(t, tt.want, got, "getTenant(%v, %v, %v, %v)", tt.args.ctx, tt.args.operatorClient, tt.args.namespace, tt.args.tenantName) - }) - } -} - -func Test_updateTenantConfigurationFile(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - opClient := opClientMock{} - kClient := k8sClientMock{} - type args struct { - ctx context.Context - operatorClient OperatorClientI - client K8sClientI - namespace string - params operator_api.UpdateTenantConfigurationParams - mockTenantGet func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) - mockGetSecret func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) - mockUpdateSecret func(ctx context.Context, namespace string, secret *corev1.Secret, opts metav1.UpdateOptions) (*corev1.Secret, error) - mockDeletePodCollection func(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - } - tests := []struct { - name string - args args - wantErr bool - }{ - { - name: "error getting tenant information", - wantErr: true, - args: args{ - ctx: ctx, - operatorClient: opClient, - client: kClient, - namespace: "default", - params: operator_api.UpdateTenantConfigurationParams{ - Namespace: "default", - Tenant: "test", - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return nil, errors.New("error getting tenant") - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return nil, nil - }, - mockUpdateSecret: func(ctx context.Context, namespace string, secret *corev1.Secret, opts metav1.UpdateOptions) (*corev1.Secret, error) { - return nil, nil - }, - mockDeletePodCollection: func(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return nil - }, - }, - }, - { - name: "error during getting tenant configuration", - wantErr: true, - args: args{ - ctx: ctx, - operatorClient: opClient, - client: kClient, - namespace: "default", - params: operator_api.UpdateTenantConfigurationParams{ - Namespace: "default", - Tenant: "test", - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "default", - Name: "test", - }, - Spec: miniov2.TenantSpec{ - Configuration: &corev1.LocalObjectReference{ - Name: "tenant-configuration-secret", - }, - }, - }, nil - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return nil, errors.New("error getting tenant configuration") - }, - mockUpdateSecret: func(ctx context.Context, namespace string, secret *corev1.Secret, opts metav1.UpdateOptions) (*corev1.Secret, error) { - return nil, nil - }, - mockDeletePodCollection: func(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return nil - }, - }, - }, - { - name: "error updating tenant configuration because of missing configuration secret", - wantErr: true, - args: args{ - ctx: ctx, - operatorClient: opClient, - client: kClient, - namespace: "default", - params: operator_api.UpdateTenantConfigurationParams{ - Namespace: "default", - Tenant: "test", - Body: &models.UpdateTenantConfigurationRequest{}, - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "default", - Name: "test", - }, - }, nil - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return &corev1.Secret{Data: map[string][]byte{ - "config.env": []byte(` - export MINIO_ROOT_USER=minio - export MINIO_ROOT_PASSWORD=minio123 - export MINIO_CONSOLE_ADDRESS=:8080 - export MINIO_IDENTITY_LDAP_SERVER_ADDR=localhost:389 - export MINIO_IDENTITY_LDAP_LOOKUP_BIND_DN="cn=admin,dc=min,dc=io" - export MINIO_IDENTITY_LDAP_LOOKUP_BIND_PASSWORD="admin" - export MINIO_IDENTITY_LDAP_USER_DN_SEARCH_BASE_DN="dc=min,dc=io" - export MINIO_IDENTITY_LDAP_USER_DN_SEARCH_FILTER="(uid=%s)" - export MINIO_IDENTITY_LDAP_GROUP_SEARCH_BASE_DN="ou=swengg,dc=min,dc=io" - export MINIO_IDENTITY_LDAP_GROUP_SEARCH_FILTER="(&(objectclass=groupOfNames)(member=%d))" - export MINIO_IDENTITY_LDAP_SERVER_INSECURE="on" - `), - }}, nil - }, - mockUpdateSecret: func(ctx context.Context, namespace string, secret *corev1.Secret, opts metav1.UpdateOptions) (*corev1.Secret, error) { - return nil, nil - }, - mockDeletePodCollection: func(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return nil - }, - }, - }, - { - name: "error because tenant configuration secret is nil", - wantErr: true, - args: args{ - ctx: ctx, - operatorClient: opClient, - client: kClient, - namespace: "default", - params: operator_api.UpdateTenantConfigurationParams{ - Namespace: "default", - Tenant: "test", - Body: &models.UpdateTenantConfigurationRequest{}, - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "default", - Name: "test", - }, - Spec: miniov2.TenantSpec{ - Configuration: &corev1.LocalObjectReference{ - Name: "tenant-configuration-secret", - }, - }, - }, nil - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return nil, nil - }, - mockUpdateSecret: func(ctx context.Context, namespace string, secret *corev1.Secret, opts metav1.UpdateOptions) (*corev1.Secret, error) { - return nil, nil - }, - mockDeletePodCollection: func(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return nil - }, - }, - }, - { - name: "error updating tenant configuration because of k8s issue", - wantErr: true, - args: args{ - ctx: ctx, - operatorClient: opClient, - client: kClient, - namespace: "default", - params: operator_api.UpdateTenantConfigurationParams{ - Namespace: "default", - Tenant: "test", - Body: &models.UpdateTenantConfigurationRequest{}, - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "default", - Name: "test", - }, - Spec: miniov2.TenantSpec{ - Configuration: &corev1.LocalObjectReference{ - Name: "tenant-configuration-secret", - }, - }, - }, nil - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return &corev1.Secret{Data: map[string][]byte{ - "config.env": []byte(` - export MINIO_ROOT_USER=minio - export MINIO_ROOT_PASSWORD=minio123 - export MINIO_CONSOLE_ADDRESS=:8080 - export MINIO_IDENTITY_LDAP_SERVER_ADDR=localhost:389 - export MINIO_IDENTITY_LDAP_LOOKUP_BIND_DN="cn=admin,dc=min,dc=io" - export MINIO_IDENTITY_LDAP_LOOKUP_BIND_PASSWORD="admin" - export MINIO_IDENTITY_LDAP_USER_DN_SEARCH_BASE_DN="dc=min,dc=io" - export MINIO_IDENTITY_LDAP_USER_DN_SEARCH_FILTER="(uid=%s)" - export MINIO_IDENTITY_LDAP_GROUP_SEARCH_BASE_DN="ou=swengg,dc=min,dc=io" - export MINIO_IDENTITY_LDAP_GROUP_SEARCH_FILTER="(&(objectclass=groupOfNames)(member=%d))" - export MINIO_IDENTITY_LDAP_SERVER_INSECURE="on" - `), - }}, nil - }, - mockUpdateSecret: func(ctx context.Context, namespace string, secret *corev1.Secret, opts metav1.UpdateOptions) (*corev1.Secret, error) { - return nil, errors.New("error updating configuration secret") - }, - mockDeletePodCollection: func(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return nil - }, - }, - }, - { - name: "error during deleting pod collection", - wantErr: true, - args: args{ - ctx: ctx, - operatorClient: opClient, - client: kClient, - namespace: "default", - params: operator_api.UpdateTenantConfigurationParams{ - Namespace: "default", - Tenant: "test", - Body: &models.UpdateTenantConfigurationRequest{}, - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "default", - Name: "test", - }, - Spec: miniov2.TenantSpec{ - Configuration: &corev1.LocalObjectReference{ - Name: "tenant-configuration-secret", - }, - }, - }, nil - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return &corev1.Secret{Data: map[string][]byte{ - "config.env": []byte(` - export MINIO_ROOT_USER=minio - export MINIO_ROOT_PASSWORD=minio123 - export MINIO_CONSOLE_ADDRESS=:8080 - export MINIO_IDENTITY_LDAP_SERVER_ADDR=localhost:389 - export MINIO_IDENTITY_LDAP_LOOKUP_BIND_DN="cn=admin,dc=min,dc=io" - export MINIO_IDENTITY_LDAP_LOOKUP_BIND_PASSWORD="admin" - export MINIO_IDENTITY_LDAP_USER_DN_SEARCH_BASE_DN="dc=min,dc=io" - export MINIO_IDENTITY_LDAP_USER_DN_SEARCH_FILTER="(uid=%s)" - export MINIO_IDENTITY_LDAP_GROUP_SEARCH_BASE_DN="ou=swengg,dc=min,dc=io" - export MINIO_IDENTITY_LDAP_GROUP_SEARCH_FILTER="(&(objectclass=groupOfNames)(member=%d))" - export MINIO_IDENTITY_LDAP_SERVER_INSECURE="on" - `), - }}, nil - }, - mockUpdateSecret: func(ctx context.Context, namespace string, secret *corev1.Secret, opts metav1.UpdateOptions) (*corev1.Secret, error) { - return nil, nil - }, - mockDeletePodCollection: func(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return errors.New("error deleting minio pods") - }, - }, - }, - { - name: "success updating tenant configuration secret", - wantErr: false, - args: args{ - ctx: ctx, - operatorClient: opClient, - client: kClient, - namespace: "default", - params: operator_api.UpdateTenantConfigurationParams{ - Namespace: "default", - Tenant: "test", - Body: &models.UpdateTenantConfigurationRequest{}, - }, - mockTenantGet: func(ctx context.Context, namespace string, tenantName string, options metav1.GetOptions) (*miniov2.Tenant, error) { - return &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "default", - Name: "test", - }, - Spec: miniov2.TenantSpec{ - Configuration: &corev1.LocalObjectReference{ - Name: "tenant-configuration-secret", - }, - }, - }, nil - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return &corev1.Secret{Data: map[string][]byte{ - "config.env": []byte(` - export MINIO_ROOT_USER=minio - export MINIO_ROOT_PASSWORD=minio123 - export MINIO_CONSOLE_ADDRESS=:8080 - export MINIO_IDENTITY_LDAP_SERVER_ADDR=localhost:389 - export MINIO_IDENTITY_LDAP_LOOKUP_BIND_DN="cn=admin,dc=min,dc=io" - export MINIO_IDENTITY_LDAP_LOOKUP_BIND_PASSWORD="admin" - export MINIO_IDENTITY_LDAP_USER_DN_SEARCH_BASE_DN="dc=min,dc=io" - export MINIO_IDENTITY_LDAP_USER_DN_SEARCH_FILTER="(uid=%s)" - export MINIO_IDENTITY_LDAP_GROUP_SEARCH_BASE_DN="ou=swengg,dc=min,dc=io" - export MINIO_IDENTITY_LDAP_GROUP_SEARCH_FILTER="(&(objectclass=groupOfNames)(member=%d))" - export MINIO_IDENTITY_LDAP_SERVER_INSECURE="on" - `), - }}, nil - }, - mockUpdateSecret: func(ctx context.Context, namespace string, secret *corev1.Secret, opts metav1.UpdateOptions) (*corev1.Secret, error) { - return nil, nil - }, - mockDeletePodCollection: func(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return nil - }, - }, - }, - } - for _, tt := range tests { - k8sclientGetSecretMock = tt.args.mockGetSecret - opClientTenantGetMock = tt.args.mockTenantGet - k8sClientUpdateSecretMock = tt.args.mockUpdateSecret - k8sClientDeletePodCollectionMock = tt.args.mockDeletePodCollection - t.Run(tt.name, func(t *testing.T) { - err := updateTenantConfigurationFile(tt.args.ctx, tt.args.operatorClient, tt.args.client, tt.args.namespace, tt.args.params) - if (err != nil) != tt.wantErr { - t.Errorf("updateTenantConfigurationFile(%v, %v, %v, %v, %v)", tt.args.ctx, tt.args.operatorClient, tt.args.client, tt.args.namespace, tt.args.params) - } - }) - } -} diff --git a/operatorapi/utils.go b/operatorapi/utils.go deleted file mode 100644 index 8541ed133..000000000 --- a/operatorapi/utils.go +++ /dev/null @@ -1,74 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "errors" - "fmt" - - miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func GetTenantConfiguration(ctx context.Context, clientSet K8sClientI, tenant *miniov2.Tenant) (map[string]string, error) { - if tenant == nil { - return nil, errors.New("tenant cannot be nil") - } - tenantConfiguration := map[string]string{} - for _, config := range tenant.GetEnvVars() { - tenantConfiguration[config.Name] = config.Value - } - // legacy support for tenants with tenant.spec.credsSecret - if tenant.HasCredsSecret() { - minioSecret, err := clientSet.getSecret(ctx, tenant.Namespace, tenant.Spec.CredsSecret.Name, metav1.GetOptions{}) - if err != nil { - return nil, err - } - configFromCredsSecret := minioSecret.Data - for key, val := range configFromCredsSecret { - tenantConfiguration[key] = string(val) - } - } - if tenant.HasConfigurationSecret() { - minioConfigurationSecret, err := clientSet.getSecret(ctx, tenant.Namespace, tenant.Spec.Configuration.Name, metav1.GetOptions{}) - if err != nil { - return tenantConfiguration, err - } - if minioConfigurationSecret == nil { - return tenantConfiguration, errors.New("tenant configuration secret is empty") - } - configFromFile := miniov2.ParseRawConfiguration(minioConfigurationSecret.Data["config.env"]) - for key, val := range configFromFile { - tenantConfiguration[key] = string(val) - } - } - return tenantConfiguration, nil -} - -func GenerateTenantConfigurationFile(configuration map[string]string) string { - var rawConfiguration string - for key, val := range configuration { - rawConfiguration += fmt.Sprintf("export %s=\"%s\"\n", key, val) - } - return rawConfiguration -} - -// Create a copy of a string and return its pointer -func stringPtr(str string) *string { - return &str -} diff --git a/operatorapi/utils_test.go b/operatorapi/utils_test.go deleted file mode 100644 index 71e7452c1..000000000 --- a/operatorapi/utils_test.go +++ /dev/null @@ -1,254 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2022 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "errors" - "testing" - - miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - "github.com/stretchr/testify/assert" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func TestGetTenantConfiguration(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - kClient := k8sClientMock{} - type args struct { - ctx context.Context - clientSet K8sClientI - tenant *miniov2.Tenant - } - tests := []struct { - name string - args args - want map[string]string - mockGetSecret func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) - wantErr bool - }{ - { - name: "error because nil tenant", - args: args{ - ctx: ctx, - clientSet: kClient, - tenant: nil, - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return nil, nil - }, - want: nil, - wantErr: true, - }, - { - name: "empty configuration map because no configuration secret is present", - args: args{ - ctx: ctx, - clientSet: kClient, - tenant: &miniov2.Tenant{}, - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return nil, nil - }, - want: map[string]string{}, - wantErr: false, - }, - { - name: "empty configuration map because error while retrieving configuration secret", - args: args{ - ctx: ctx, - clientSet: kClient, - tenant: &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - Configuration: &corev1.LocalObjectReference{ - Name: "tenant-configuration-secret", - }, - }, - }, - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return nil, errors.New("an error has occurred") - }, - want: map[string]string{}, - wantErr: true, - }, - { - name: "parsing tenant configuration from secret file", - args: args{ - ctx: ctx, - clientSet: kClient, - tenant: &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - Configuration: &corev1.LocalObjectReference{ - Name: "tenant-configuration-secret", - }, - }, - }, - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return &corev1.Secret{Data: map[string][]byte{ - "config.env": []byte(` -export MINIO_ROOT_USER=minio -export MINIO_ROOT_PASSWORD=minio123 -export MINIO_CONSOLE_ADDRESS=:8080 -export MINIO_IDENTITY_LDAP_SERVER_ADDR=localhost:389 -export MINIO_IDENTITY_LDAP_LOOKUP_BIND_DN="cn=admin,dc=min,dc=io" -export MINIO_IDENTITY_LDAP_LOOKUP_BIND_PASSWORD="admin" -export MINIO_IDENTITY_LDAP_USER_DN_SEARCH_BASE_DN="dc=min,dc=io" -export MINIO_IDENTITY_LDAP_USER_DN_SEARCH_FILTER="(uid=%s)" -export MINIO_IDENTITY_LDAP_GROUP_SEARCH_BASE_DN="ou=swengg,dc=min,dc=io" -export MINIO_IDENTITY_LDAP_GROUP_SEARCH_FILTER="(&(objectclass=groupOfNames)(member=%d))" -export MINIO_IDENTITY_LDAP_SERVER_INSECURE="on" -`), - }}, nil - }, - want: map[string]string{ - "MINIO_ROOT_USER": "minio", - "MINIO_ROOT_PASSWORD": "minio123", - "MINIO_CONSOLE_ADDRESS": ":8080", - "accesskey": "minio", - "secretkey": "minio123", - "MINIO_IDENTITY_LDAP_SERVER_INSECURE": "on", - "MINIO_IDENTITY_LDAP_GROUP_SEARCH_FILTER": "(&(objectclass=groupOfNames)(member=%d))", - "MINIO_IDENTITY_LDAP_GROUP_SEARCH_BASE_DN": "ou=swengg,dc=min,dc=io", - "MINIO_IDENTITY_LDAP_USER_DN_SEARCH_FILTER": "(uid=%s)", - "MINIO_IDENTITY_LDAP_USER_DN_SEARCH_BASE_DN": "dc=min,dc=io", - "MINIO_IDENTITY_LDAP_LOOKUP_BIND_PASSWORD": "admin", - "MINIO_IDENTITY_LDAP_LOOKUP_BIND_DN": "cn=admin,dc=min,dc=io", - "MINIO_IDENTITY_LDAP_SERVER_ADDR": "localhost:389", - }, - wantErr: false, - }, - { - name: "parsing tenant configuration from secret file and environment variables", - args: args{ - ctx: ctx, - clientSet: kClient, - tenant: &miniov2.Tenant{ - Spec: miniov2.TenantSpec{ - Env: []corev1.EnvVar{ - { - Name: "MINIO_KMS_SECRET_KEY", - Value: "my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw=", - }, - }, - Configuration: &corev1.LocalObjectReference{ - Name: "tenant-configuration-secret", - }, - }, - }, - }, - mockGetSecret: func(ctx context.Context, namespace, secretName string, opts metav1.GetOptions) (*corev1.Secret, error) { - return &corev1.Secret{Data: map[string][]byte{ - "config.env": []byte(` -export MINIO_ROOT_USER=minio -export MINIO_ROOT_PASSWORD=minio123 -export MINIO_CONSOLE_ADDRESS=:8080 -export MINIO_IDENTITY_LDAP_SERVER_ADDR=localhost:389 -export MINIO_IDENTITY_LDAP_LOOKUP_BIND_DN="cn=admin,dc=min,dc=io" -export MINIO_IDENTITY_LDAP_LOOKUP_BIND_PASSWORD="admin" -export MINIO_IDENTITY_LDAP_USER_DN_SEARCH_BASE_DN="dc=min,dc=io" -export MINIO_IDENTITY_LDAP_USER_DN_SEARCH_FILTER="(uid=%s)" -export MINIO_IDENTITY_LDAP_GROUP_SEARCH_BASE_DN="ou=swengg,dc=min,dc=io" -export MINIO_IDENTITY_LDAP_GROUP_SEARCH_FILTER="(&(objectclass=groupOfNames)(member=%d))" -export MINIO_IDENTITY_LDAP_SERVER_INSECURE="on" -`), - }}, nil - }, - want: map[string]string{ - "MINIO_ROOT_USER": "minio", - "MINIO_ROOT_PASSWORD": "minio123", - "MINIO_CONSOLE_ADDRESS": ":8080", - "accesskey": "minio", - "secretkey": "minio123", - "MINIO_IDENTITY_LDAP_SERVER_INSECURE": "on", - "MINIO_IDENTITY_LDAP_GROUP_SEARCH_FILTER": "(&(objectclass=groupOfNames)(member=%d))", - "MINIO_IDENTITY_LDAP_GROUP_SEARCH_BASE_DN": "ou=swengg,dc=min,dc=io", - "MINIO_IDENTITY_LDAP_USER_DN_SEARCH_FILTER": "(uid=%s)", - "MINIO_IDENTITY_LDAP_USER_DN_SEARCH_BASE_DN": "dc=min,dc=io", - "MINIO_IDENTITY_LDAP_LOOKUP_BIND_PASSWORD": "admin", - "MINIO_IDENTITY_LDAP_LOOKUP_BIND_DN": "cn=admin,dc=min,dc=io", - "MINIO_IDENTITY_LDAP_SERVER_ADDR": "localhost:389", - "MINIO_KMS_SECRET_KEY": "my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw=", - }, - wantErr: false, - }, - } - for _, tt := range tests { - k8sclientGetSecretMock = tt.mockGetSecret - t.Run(tt.name, func(t *testing.T) { - got, err := GetTenantConfiguration(tt.args.ctx, tt.args.clientSet, tt.args.tenant) - if (err != nil) != tt.wantErr { - t.Errorf("GetTenantConfiguration(%v, %v, %v)", tt.args.ctx, tt.args.clientSet, tt.args.tenant) - } - assert.Equalf(t, tt.want, got, "GetTenantConfiguration(%v, %v, %v)", tt.args.ctx, tt.args.clientSet, tt.args.tenant) - }) - } -} - -func TestGenerateTenantConfigurationFile(t *testing.T) { - type args struct { - configuration map[string]string - } - tests := []struct { - name string - args args - want string - }{ - { - name: "convert configuration map into raw string", - args: args{ - configuration: map[string]string{ - "MINIO_ROOT_USER": "minio", - }, - }, - want: `export MINIO_ROOT_USER="minio" -`, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - assert.Equalf(t, tt.want, GenerateTenantConfigurationFile(tt.args.configuration), "GenerateTenantConfigurationFile(%v)", tt.args.configuration) - }) - } -} - -func Test_stringPtr(t *testing.T) { - type args struct { - str string - } - tests := []struct { - name string - args args - wantNil bool - }{ - { - name: "get a pointer", - args: args{ - str: "", - }, - wantNil: false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - assert.NotNilf(t, stringPtr(tt.args.str), "stringPtr(%v)", tt.args.str) - }) - } -} diff --git a/operatorapi/version.go b/operatorapi/version.go deleted file mode 100644 index 605242b4d..000000000 --- a/operatorapi/version.go +++ /dev/null @@ -1,60 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2022 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "net/http" - "time" - - errors "github.com/minio/console/restapi" - - xhttp "github.com/minio/console/pkg/http" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations" - "github.com/minio/console/operatorapi/operations/user_api" - "github.com/minio/console/pkg/utils" -) - -func registerVersionHandlers(api *operations.OperatorAPI) { - api.UserAPICheckMinIOVersionHandler = user_api.CheckMinIOVersionHandlerFunc(func(params user_api.CheckMinIOVersionParams) middleware.Responder { - versionResponse, err := getVersionResponse(params) - if err != nil { - return user_api.NewCheckMinIOVersionDefault(int(err.Code)).WithPayload(err) - } - return user_api.NewCheckMinIOVersionOK().WithPayload(versionResponse) - }) -} - -// getSessionResponse parse the token of the current session and returns a list of allowed actions to render in the UI -func getVersionResponse(params user_api.CheckMinIOVersionParams) (*models.CheckOperatorVersionResponse, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - ver, err := utils.GetLatestMinIOImage(&xhttp.Client{ - Client: &http.Client{ - Timeout: 15 * time.Second, - }, - }) - if err != nil { - return nil, errors.ErrorWithContext(ctx, err) - } - return &models.CheckOperatorVersionResponse{ - LatestVersion: *ver, - }, nil -} diff --git a/operatorapi/volumes.go b/operatorapi/volumes.go deleted file mode 100644 index c89863149..000000000 --- a/operatorapi/volumes.go +++ /dev/null @@ -1,344 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "fmt" - "sort" - - errors "github.com/minio/console/restapi" - - miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/cluster" - "github.com/minio/console/models" - "github.com/minio/console/operatorapi/operations" - "github.com/minio/console/operatorapi/operations/operator_api" - v1 "k8s.io/api/certificates/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func registerVolumesHandlers(api *operations.OperatorAPI) { - api.OperatorAPIListPVCsHandler = operator_api.ListPVCsHandlerFunc(func(params operator_api.ListPVCsParams, session *models.Principal) middleware.Responder { - payload, err := getPVCsResponse(session, params) - if err != nil { - return operator_api.NewListPVCsDefault(int(err.Code)).WithPayload(err) - } - - return operator_api.NewListPVCsOK().WithPayload(payload) - }) - - api.OperatorAPIListPVCsForTenantHandler = operator_api.ListPVCsForTenantHandlerFunc(func(params operator_api.ListPVCsForTenantParams, session *models.Principal) middleware.Responder { - payload, err := getPVCsForTenantResponse(session, params) - if err != nil { - return operator_api.NewListPVCsForTenantDefault(int(err.Code)).WithPayload(err) - } - - return operator_api.NewListPVCsForTenantOK().WithPayload(payload) - }) - - api.OperatorAPIListTenantCertificateSigningRequestHandler = operator_api.ListTenantCertificateSigningRequestHandlerFunc(func(params operator_api.ListTenantCertificateSigningRequestParams, session *models.Principal) middleware.Responder { - payload, err := getTenantCSResponse(session, params) - if err != nil { - return operator_api.NewListTenantCertificateSigningRequestDefault(int(err.Code)).WithPayload(err) - } - - return operator_api.NewListTenantCertificateSigningRequestOK().WithPayload(payload) - }) - - api.OperatorAPIDeletePVCHandler = operator_api.DeletePVCHandlerFunc(func(params operator_api.DeletePVCParams, session *models.Principal) middleware.Responder { - err := getDeletePVCResponse(session, params) - if err != nil { - return operator_api.NewDeletePVCDefault(int(err.Code)).WithPayload(err) - } - return nil - }) - - api.OperatorAPIGetPVCEventsHandler = operator_api.GetPVCEventsHandlerFunc(func(params operator_api.GetPVCEventsParams, session *models.Principal) middleware.Responder { - payload, err := getPVCEventsResponse(session, params) - if err != nil { - return operator_api.NewGetPVCEventsDefault(int(err.Code)).WithPayload(err) - } - - return operator_api.NewGetPVCEventsOK().WithPayload(payload) - }) - - api.OperatorAPIGetPVCDescribeHandler = operator_api.GetPVCDescribeHandlerFunc(func(params operator_api.GetPVCDescribeParams, session *models.Principal) middleware.Responder { - payload, err := getPVCDescribeResponse(session, params) - if err != nil { - return operator_api.NewGetPVCDescribeDefault(int(err.Code)).WithPayload(err) - } - return operator_api.NewGetPVCDescribeOK().WithPayload(payload) - }) -} - -func getPVCsResponse(session *models.Principal, params operator_api.ListPVCsParams) (*models.ListPVCsResponse, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - clientset, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, errors.ErrorWithContext(ctx, err) - } - - // Filter Tenant PVCs. They keep their v1 tenant annotation - listOpts := metav1.ListOptions{ - LabelSelector: miniov2.TenantLabel, - } - - // List all PVCs - listAllPvcs, err2 := clientset.CoreV1().PersistentVolumeClaims("").List(ctx, listOpts) - - if err2 != nil { - return nil, errors.ErrorWithContext(ctx, err2) - } - - var ListPVCs []*models.PvcsListResponse - - for _, pvc := range listAllPvcs.Items { - status := string(pvc.Status.Phase) - if pvc.DeletionTimestamp != nil { - status = "Terminating" - } - pvcResponse := models.PvcsListResponse{ - Name: pvc.Name, - Age: pvc.CreationTimestamp.String(), - Capacity: pvc.Status.Capacity.Storage().String(), - Namespace: pvc.Namespace, - Status: status, - StorageClass: *pvc.Spec.StorageClassName, - Volume: pvc.Spec.VolumeName, - Tenant: pvc.Labels["v1.min.io/tenant"], - } - ListPVCs = append(ListPVCs, &pvcResponse) - } - - PVCsResponse := models.ListPVCsResponse{ - Pvcs: ListPVCs, - } - - return &PVCsResponse, nil -} - -func getPVCsForTenantResponse(session *models.Principal, params operator_api.ListPVCsForTenantParams) (*models.ListPVCsResponse, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - clientset, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, errors.ErrorWithContext(ctx, err) - } - - // Filter Tenant PVCs. They keep their v1 tenant annotation - listOpts := metav1.ListOptions{ - LabelSelector: fmt.Sprintf("v1.min.io/tenant=%s", params.Tenant), - } - - // List all PVCs - listAllPvcs, err2 := clientset.CoreV1().PersistentVolumeClaims(params.Namespace).List(ctx, listOpts) - - if err2 != nil { - return nil, errors.ErrorWithContext(ctx, err2) - } - - var ListPVCs []*models.PvcsListResponse - - for _, pvc := range listAllPvcs.Items { - status := string(pvc.Status.Phase) - if pvc.DeletionTimestamp != nil { - status = "Terminating" - } - pvcResponse := models.PvcsListResponse{ - Name: pvc.Name, - Age: pvc.CreationTimestamp.String(), - Capacity: pvc.Status.Capacity.Storage().String(), - Namespace: pvc.Namespace, - Status: status, - StorageClass: *pvc.Spec.StorageClassName, - Volume: pvc.Spec.VolumeName, - Tenant: pvc.Labels["v1.min.io/tenant"], - } - ListPVCs = append(ListPVCs, &pvcResponse) - } - - PVCsResponse := models.ListPVCsResponse{ - Pvcs: ListPVCs, - } - - return &PVCsResponse, nil -} - -func getDeletePVCResponse(session *models.Principal, params operator_api.DeletePVCParams) *models.Error { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - // get Kubernetes Client - clientset, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return errors.ErrorWithContext(ctx, err) - } - listOpts := metav1.ListOptions{ - LabelSelector: fmt.Sprintf("v1.min.io/tenant=%s", params.Tenant), - FieldSelector: fmt.Sprintf("metadata.name=%s", params.PVCName), - } - if err = clientset.CoreV1().PersistentVolumeClaims(params.Namespace).DeleteCollection(ctx, metav1.DeleteOptions{}, listOpts); err != nil { - return errors.ErrorWithContext(ctx, err) - } - return nil -} - -func getPVCEventsResponse(session *models.Principal, params operator_api.GetPVCEventsParams) (models.EventListWrapper, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - clientset, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, errors.ErrorWithContext(ctx, err) - } - PVC, err := clientset.CoreV1().PersistentVolumeClaims(params.Namespace).Get(ctx, params.PVCName, metav1.GetOptions{}) - if err != nil { - return nil, errors.ErrorWithContext(ctx, err) - } - events, err := clientset.CoreV1().Events(params.Namespace).List(ctx, metav1.ListOptions{FieldSelector: fmt.Sprintf("involvedObject.uid=%s", PVC.UID)}) - if err != nil { - return nil, errors.ErrorWithContext(ctx, err) - } - retval := models.EventListWrapper{} - for i := 0; i < len(events.Items); i++ { - retval = append(retval, &models.EventListElement{ - Namespace: events.Items[i].Namespace, - LastSeen: events.Items[i].LastTimestamp.Unix(), - Message: events.Items[i].Message, - EventType: events.Items[i].Type, - Reason: events.Items[i].Reason, - }) - } - sort.SliceStable(retval, func(i int, j int) bool { - return retval[i].LastSeen < retval[j].LastSeen - }) - return retval, nil -} - -func getTenantCSResponse(session *models.Principal, params operator_api.ListTenantCertificateSigningRequestParams) (*models.CsrElements, *models.Error) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - clientset, err := cluster.K8sClient(session.STSSessionToken) - if err != nil { - return nil, errors.ErrorWithContext(ctx, err) - } - - // Get CSRs by Label "v1.min.io/tenant=" + params.Tenant - listByTenantLabel := metav1.ListOptions{LabelSelector: "v1.min.io/tenant=" + params.Tenant} - listResult, listError := clientset.CertificatesV1().CertificateSigningRequests().List(ctx, listByTenantLabel) - if listError != nil { - return nil, errors.ErrorWithContext(ctx, listError) - } - - // Get CSR by label "v1.min.io/kes=" + params.Tenant + "-kes" - listByKESLabel := metav1.ListOptions{LabelSelector: "v1.min.io/kes=" + params.Tenant + "-kes"} - listKESResult, listKESError := clientset.CertificatesV1().CertificateSigningRequests().List(ctx, listByKESLabel) - if listKESError != nil { - return nil, errors.ErrorWithContext(ctx, listKESError) - } - - var listOfCSRs []v1.CertificateSigningRequest - for index := 0; index < len(listResult.Items); index++ { - listOfCSRs = append(listOfCSRs, listResult.Items[index]) - } - for index := 0; index < len(listKESResult.Items); index++ { - listOfCSRs = append(listOfCSRs, listKESResult.Items[index]) - } - - var arrayElements []*models.CsrElement - for index := 0; index < len(listOfCSRs); index++ { - csrResult := listOfCSRs[index] - annotations := []*models.Annotation{} - for k, v := range csrResult.ObjectMeta.Annotations { - annotations = append(annotations, &models.Annotation{Key: k, Value: v}) - } - var DeletionGracePeriodSeconds int64 - DeletionGracePeriodSeconds = 0 - if csrResult.ObjectMeta.DeletionGracePeriodSeconds != nil { - DeletionGracePeriodSeconds = *csrResult.ObjectMeta.DeletionGracePeriodSeconds - } - messages := "" - // A CSR.Status can contain multiple Conditions - for i := 0; i < len(csrResult.Status.Conditions); i++ { - messages = messages + " " + csrResult.Status.Conditions[i].Message - } - retval := &models.CsrElement{ - Name: csrResult.ObjectMeta.Name, - Annotations: annotations, - DeletionGracePeriodSeconds: DeletionGracePeriodSeconds, - GenerateName: csrResult.ObjectMeta.GenerateName, - Generation: csrResult.ObjectMeta.Generation, - Namespace: csrResult.ObjectMeta.Namespace, - ResourceVersion: csrResult.ObjectMeta.ResourceVersion, - Status: messages, - } - arrayElements = append(arrayElements, retval) - } - result := &models.CsrElements{CsrElement: arrayElements} - return result, nil -} - -func getPVCDescribeResponse(session *models.Principal, params operator_api.GetPVCDescribeParams) (*models.DescribePVCWrapper, *models.Error) { - clientSet, err := cluster.K8sClient(session.STSSessionToken) - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - if err != nil { - return nil, errors.ErrorWithContext(ctx, err) - } - k8sClient := k8sClient{client: clientSet} - return getPVCDescribe(ctx, params.Namespace, params.PVCName, &k8sClient) -} - -func getPVCDescribe(ctx context.Context, namespace string, pvcName string, clientSet K8sClientI) (*models.DescribePVCWrapper, *models.Error) { - pvc, err := clientSet.getPVC(ctx, namespace, pvcName, metav1.GetOptions{}) - if err != nil { - return nil, errors.ErrorWithContext(ctx, err) - } - accessModes := []string{} - for _, a := range pvc.Status.AccessModes { - accessModes = append(accessModes, string(a)) - } - return &models.DescribePVCWrapper{ - Name: pvc.Name, - Namespace: pvc.Namespace, - StorageClass: *pvc.Spec.StorageClassName, - Status: string(pvc.Status.Phase), - Volume: pvc.Spec.VolumeName, - Labels: castLabels(pvc.Labels), - Annotations: castAnnotations(pvc.Annotations), - Finalizers: pvc.Finalizers, - Capacity: pvc.Status.Capacity.Storage().String(), - AccessModes: accessModes, - VolumeMode: string(*pvc.Spec.VolumeMode), - }, nil -} - -func castLabels(labelsToCast map[string]string) (labels []*models.Label) { - for k, v := range labelsToCast { - labels = append(labels, &models.Label{Key: k, Value: v}) - } - return labels -} - -func castAnnotations(annotationsToCast map[string]string) (annotations []*models.Annotation) { - for k, v := range annotationsToCast { - annotations = append(annotations, &models.Annotation{Key: k, Value: v}) - } - return annotations -} diff --git a/operatorapi/volumes_test.go b/operatorapi/volumes_test.go deleted file mode 100644 index 7114c5855..000000000 --- a/operatorapi/volumes_test.go +++ /dev/null @@ -1,81 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package operatorapi - -import ( - "context" - "errors" - "testing" - - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -var ( - getPVCWithError = true - pvcMockName = "mockName" - pvcMockNamespace = "mockNamespace" -) - -func (c k8sClientMock) getPVC(ctx context.Context, namespace string, pvcName string, opts metav1.GetOptions) (*v1.PersistentVolumeClaim, error) { - if getPVCWithError { - return nil, errors.New("Mock error during getPVC") - } - return createMockPVC(pvcMockName, pvcMockNamespace), nil -} - -var testCasesGetPVCDescribe = []struct { - name string - errorExpected bool -}{ - { - name: "Successful getPVCDescribe", - errorExpected: false, - }, - { - name: "Error getPVCDescribe", - errorExpected: true, - }, -} - -func TestGetPVCDescribe(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - kClient := k8sClientMock{} - for _, tt := range testCasesGetPVCDescribe { - t.Run(tt.name, func(t *testing.T) { - getPVCWithError = tt.errorExpected - pvc, err := getPVCDescribe(ctx, pvcMockNamespace, pvcMockName, kClient) - if err != nil { - if tt.errorExpected { - return - } - t.Errorf("getPVCDescribe() error = %v, errorExpected %v", err, tt.errorExpected) - } - if pvc == nil { - t.Errorf("getPVCDescribe() expected type: *v1.PersistentVolumeClaim, got: nil") - return - } - if pvc.Name != pvcMockName { - t.Errorf("Expected pvc name %s got %s", pvc.Name, pvcMockName) - } - if pvc.Namespace != pvcMockNamespace { - t.Errorf("Expected pvc namespace %s got %s", pvc.Namespace, pvcMockNamespace) - } - }) - } -} diff --git a/portal-ui/src/ProtectedRoutes.tsx b/portal-ui/src/ProtectedRoutes.tsx index d75c40fd8..ac2eb7cf4 100644 --- a/portal-ui/src/ProtectedRoutes.tsx +++ b/portal-ui/src/ProtectedRoutes.tsx @@ -23,10 +23,7 @@ import { ErrorResponseHandler } from "./common/types"; import { ReplicationSite } from "./screens/Console/Configurations/SiteReplication/SiteReplication"; import { useSelector } from "react-redux"; import { - directPVMode, globalSetDistributedSetup, - operatorMode, - selOpMode, setAnonymousMode, setOverrideStyles, setSiteReplicationInfo, @@ -45,8 +42,6 @@ interface ProtectedRouteProps { const ProtectedRoute = ({ Component }: ProtectedRouteProps) => { const dispatch = useAppDispatch(); - const isOperatorMode = useSelector(selOpMode); - const [sessionLoading, setSessionLoading] = useState(true); const userLoggedIn = useSelector((state: AppState) => state.system.loggedIn); const anonymousMode = useSelector( @@ -70,12 +65,6 @@ const ProtectedRoute = ({ Component }: ProtectedRouteProps) => { dispatch(userLogged(true)); setSessionLoading(false); dispatch(globalSetDistributedSetup(res.distributedMode || false)); - // check for tenants presence, that indicates we are in operator mode - if (res.operator) { - dispatch(operatorMode(true)); - dispatch(directPVMode(!!res.directPV)); - document.title = "MinIO Operator"; - } if (res.customStyles && res.customStyles !== "") { const overrideColorVariants = getOverrideColorVariants( @@ -147,7 +136,7 @@ const ProtectedRoute = ({ Component }: ProtectedRouteProps) => { ); useEffect(() => { - if (userLoggedIn && !sessionLoading && !isOperatorMode && !anonymousMode) { + if (userLoggedIn && !sessionLoading && !anonymousMode) { invokeSRInfoApi("GET", `api/v1/admin/site-replication`); } // eslint-disable-next-line react-hooks/exhaustive-deps diff --git a/portal-ui/src/common/SecureComponent/__tests__/accessControl.test.ts b/portal-ui/src/common/SecureComponent/__tests__/accessControl.test.ts index 1c3d26ef8..09149fc2d 100644 --- a/portal-ui/src/common/SecureComponent/__tests__/accessControl.test.ts +++ b/portal-ui/src/common/SecureComponent/__tests__/accessControl.test.ts @@ -47,7 +47,6 @@ const setPolicy1 = () => { ], "console-ui": ["admin:CreateServiceAccount", "admin:CreateUser"], }, - operator: false, status: "ok", }) ); @@ -56,7 +55,6 @@ const setPolicy2 = () => { store.dispatch( saveSessionResponse({ distributedMode: true, - operator: false, features: [], permissions: { "arn:aws:s3:::bucket-svc": [ @@ -108,7 +106,6 @@ const setPolicy3 = () => { "console-ui": ["admin:CreateServiceAccount", "admin:CreateUser"], }, status: "ok", - operator: false, }) ); }; @@ -124,7 +121,6 @@ const setPolicy4 = () => { "arn:aws:s3:::test/digitalinsights/xref_cust_guid_actd*": ["s3:*"], }, status: "ok", - operator: false, }) ); }; diff --git a/portal-ui/src/common/SecureComponent/permissions.ts b/portal-ui/src/common/SecureComponent/permissions.ts index 0fe66f770..0325608f1 100644 --- a/portal-ui/src/common/SecureComponent/permissions.ts +++ b/portal-ui/src/common/SecureComponent/permissions.ts @@ -210,53 +210,6 @@ export const IAM_PAGES = { SITE_REPLICATION: "/settings/site-replication", SITE_REPLICATION_STATUS: "/settings/site-replication/status", SITE_REPLICATION_ADD: "/settings/site-replication/add", - - /* Operator */ - TENANTS: "/tenants", - TENANTS_ADD: "/tenants/add", - NAMESPACE_TENANT: "/namespaces/:tenantNamespace/tenants/:tenantName", - NAMESPACE_TENANT_HOP: "/namespaces/:tenantNamespace/tenants/:tenantName/hop", - NAMESPACE_TENANT_PODS: - "/namespaces/:tenantNamespace/tenants/:tenantName/pods/:podName", - NAMESPACE_TENANT_PVCS: - "/namespaces/:tenantNamespace/tenants/:tenantName/pvcs/:PVCName", - NAMESPACE_TENANT_PODS_LIST: - "/namespaces/:tenantNamespace/tenants/:tenantName/pods", - NAMESPACE_TENANT_SUMMARY: - "/namespaces/:tenantNamespace/tenants/:tenantName/summary", - NAMESPACE_TENANT_METRICS: - "/namespaces/:tenantNamespace/tenants/:tenantName/metrics", - NAMESPACE_TENANT_TRACE: - "/namespaces/:tenantNamespace/tenants/:tenantName/trace", - NAMESPACE_TENANT_POOLS: - "/namespaces/:tenantNamespace/tenants/:tenantName/pools", - NAMESPACE_TENANT_POOLS_ADD: - "/namespaces/:tenantNamespace/tenants/:tenantName/add-pool", - NAMESPACE_TENANT_POOLS_EDIT: - "/namespaces/:tenantNamespace/tenants/:tenantName/edit-pool", - NAMESPACE_TENANT_VOLUMES: - "/namespaces/:tenantNamespace/tenants/:tenantName/volumes", - NAMESPACE_TENANT_LICENSE: - "/namespaces/:tenantNamespace/tenants/:tenantName/license", - NAMESPACE_TENANT_IDENTITY_PROVIDER: - "/namespaces/:tenantNamespace/tenants/:tenantName/identity-provider", - NAMESPACE_TENANT_SECURITY: - "/namespaces/:tenantNamespace/tenants/:tenantName/security", - NAMESPACE_TENANT_ENCRYPTION: - "/namespaces/:tenantNamespace/tenants/:tenantName/encryption", - NAMESPACE_TENANT_MONITORING: - "/namespaces/:tenantNamespace/tenants/:tenantName/monitoring", - NAMESPACE_TENANT_LOGGING: - "/namespaces/:tenantNamespace/tenants/:tenantName/logging", - NAMESPACE_TENANT_EVENTS: - "/namespaces/:tenantNamespace/tenants/:tenantName/events", - NAMESPACE_TENANT_CSR: "/namespaces/:tenantNamespace/tenants/:tenantName/csr", - OPERATOR_MARKETPLACE: "/marketplace", - - /* DirectPV */ - DIRECTPV_STORAGE: "/storage", - DIRECTPV_DRIVES: "/drives", - DIRECTPV_VOLUMES: "/volumes", }; // roles diff --git a/portal-ui/src/common/types.ts b/portal-ui/src/common/types.ts index 03cc8557c..b4ee6667c 100644 --- a/portal-ui/src/common/types.ts +++ b/portal-ui/src/common/types.ts @@ -14,322 +14,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -import { - ILabelKeyPair, - ISecurityContext, -} from "../screens/Console/Tenants/types"; - -export interface ITenantsObject { - tenants: ITenant[]; -} - -export interface ITenant { - creation_date: string; - deletion_date: string; - currentState: string; - image: string; - instance_count: string; - name: string; - namespace?: string; - total_size: string; - used_size: string; - volume_count: string; - volume_size: string; - volumes_per_server?: string; - pool_count: string; - pools?: IPoolModel[]; - used_capacity?: string; - endpoint?: string; - storage_class?: string; - enable_prometheus: boolean; -} - -export interface IVolumeConfiguration { - size: string; - storage_class_name: string; - labels?: any; -} - -export interface IDomainsRequest { - console?: string; - minio?: string[]; -} - -export interface ITenantCreator { - name: string; - service_name: string; - enable_console: boolean; - enable_prometheus: boolean; - enable_tls: boolean; - access_key: string; - secret_key: string; - access_keys: string[]; - secret_keys: string[]; - image: string; - expose_minio: boolean; - expose_console: boolean; - pools: IPoolModel[]; - namespace: string; - erasureCodingParity: number; - tls?: ITLSTenantConfiguration; - encryption?: IEncryptionConfiguration; - idp?: IIDPConfiguration; - annotations?: Object; - image_registry?: ImageRegistry; - logSearchConfiguration?: LogSearchConfiguration; - prometheusConfiguration?: PrometheusConfiguration; - affinity?: AffinityConfiguration; - domains?: IDomainsRequest; -} - -export interface ImageRegistry { - registry: string; - username: string; - password: string; -} - -export interface ITenantUpdateObject { - image: string; - image_registry?: IRegistryObject; -} - -export interface IRegistryObject { - registry: string; - username: string; - password: string; -} - -export interface ITenantUsage { - used: string; - disk_used: string; -} - -export interface IAffinityModel { - podAntiAffinity?: IPodAntiAffinityModel; - nodeAffinity?: INodeAffinityModel; -} - -export interface IPodAntiAffinityModel { - requiredDuringSchedulingIgnoredDuringExecution: IPodAffinityTerm[]; -} - -export interface IPodAffinityTerm { - labelSelector: IPodAffinityTermLabelSelector; - topologyKey: string; -} - -export interface IPodAffinityTermLabelSelector { - matchExpressions: IMatchExpressionItem[]; -} - -export interface INodeAffinityModel { - requiredDuringSchedulingIgnoredDuringExecution: INodeAffinityTerms; -} - -export interface INodeAffinityTerms { - nodeSelectorTerms: INodeAffinityLabelsSelector[]; -} - -export interface INodeAffinityLabelsSelector { - matchExpressions: IMatchExpressionItem[]; -} - -export interface IMatchExpressionItem { - key: string; - operator: string; - values: string[]; -} - -export enum ITolerationEffect { - "NoSchedule" = "NoSchedule", - "PreferNoSchedule" = "PreferNoSchedule", - "NoExecute" = "NoExecute", -} - -export enum ITolerationOperator { - "Equal" = "Equal", - "Exists" = "Exists", -} - -export interface ITolerationModel { - effect: ITolerationEffect; - key: string; - operator: ITolerationOperator; - value?: string; - tolerationSeconds?: ITolerationSeconds; -} - -export interface ITolerationSeconds { - seconds: number; -} - -export interface IResourceModel { - requests?: IResourceRequests; - limits?: IResourceLimits; -} - -export interface IResourceRequests { - memory?: number; - cpu?: number; -} - -export interface IResourceLimits { - memory?: number; - cpu?: number; -} - -export interface ITLSTenantConfiguration { - minio: ITLSConfiguration; - console: ITLSConfiguration; -} - -export interface ITLSConfiguration { - crt: string; - key: string; -} - -export interface IEncryptionConfiguration { - server: ITLSConfiguration; - client: ITLSConfiguration; - master_key?: string; - gemalto?: IGemaltoConfig; - aws?: IAWSConfig; - vault?: IVaultConfig; - azure?: IAzureConfig; - gcp?: IGCPConfig; -} - -export interface IGCPCredentials { - client_email: string; - client_id: string; - private_key_id: string; - private_key: string; -} - -export interface IGCPSecretManager { - project_id: string; - endpoint?: string; - credentials?: IGCPCredentials; -} - -export interface IGCPConfig { - secretmanager: IGCPSecretManager; -} - -export interface IAzureCredentials { - tenant_id: string; - client_id: string; - client_secret: string; -} - -export interface IAzureKeyVault { - endpoint: string; - credentials?: IAzureCredentials; -} - -export interface IAzureConfig { - keyvault: IAzureKeyVault; -} - -export interface IVaultConfig { - endpoint: string; - engine?: string; - namespace?: string; - prefix?: string; - approle: IApproleConfig; - tls: IVaultTLSConfig; - status: IVaultStatusConfig; -} - -export interface IGemaltoConfig { - keysecure: IKeysecureConfig; -} - -export interface IAWSConfig { - secretsmanager: ISecretsManagerConfig; -} - -export interface IApproleConfig { - engine: string; - id: string; - secret: string; - retry: number; -} - -export interface IVaultTLSConfig { - key: string; - crt: string; - ca: string; -} - -export interface IVaultStatusConfig { - ping: number; -} - -export interface IKeysecureConfig { - endpoint: string; - credentials: IGemaltoCredentials; - tls: IGemaltoTLSConfig; -} - -export interface IGemaltoCredentials { - token: string; - domain: string; - retry?: string; -} - -export interface IGemaltoTLSConfig { - ca: string; -} - -export interface ISecretsManagerConfig { - endpoint: string; - region: string; - kmskey?: string; - credentials: IAWSCredentials; -} - -export interface IAWSCredentials { - accesskey: string; - secretkey: string; - token?: string; -} - -export interface IIDPConfiguration { - oidc?: IOpenIDConfiguration; - active_directory: IActiveDirectoryConfiguration; -} - -export interface IOpenIDConfiguration { - url: string; - client_id: string; - secret_id: string; -} - -export interface IActiveDirectoryConfiguration { - url: string; - skip_tls_verification: boolean; - server_insecure: boolean; - server_start_tls: boolean; - username_search_filter: string; - group_Search_base_dn: string; - group_search_filter: string; - group_name_attribute: string; - user_dns: string[]; - lookup_bind_dn: string; - lookup_bind_password: string; - user_dn_search_base_dn: string; - user_dn_search_filter: string; -} - -export interface IStorageDistribution { - error: number | string; - nodes: number; - persistentVolumes: number; - disks: number; - pvSize: number; -} - export interface IStorageFactors { erasureCode: string; storageFactor: number; @@ -337,81 +21,6 @@ export interface IStorageFactors { maxFailureTolerations: number; } -export interface ITenantHealthInList { - name: string; - namespace: string; - status?: string; - message?: string; -} - -export interface ITenantsListHealthRequest { - tenants: ITenantHealthInList[]; -} - -export interface IMaxAllocatableMemoryRequest { - num_nodes: number; -} - -export interface IMaxAllocatableMemoryResponse { - max_memory: number; -} - -export interface IEncryptionUpdateRequest { - encryption: IEncryptionConfiguration; -} - -export interface IArchivedTenantsList { - tenants: IArchivedTenant[]; -} - -export interface IArchivedTenant { - namespace: string; - tenant: string; - number_volumes: number; - capacity: number; -} - -export interface IPoolModel { - name?: string; - servers: number; - volumes_per_server: number; - volume_configuration: IVolumeConfiguration; - affinity?: IAffinityModel; - tolerations?: ITolerationModel[]; - resources?: IResourceModel; - securityContext?: ISecurityContext | null; -} - -export interface IUpdatePool { - pools: IPoolModel[]; -} - -export interface INode { - name: string; - freeSpace: string; - totalSpace: string; - disks: IDisk[]; -} - -export interface IStorageType { - freeSpace: string; - totalSpace: string; - storageClasses: string[]; - nodes: INode[]; - schedulableNodes: INode[]; -} - -export interface IDisk { - name: string; - freeSpace: string; - totalSpace: string; -} - -export interface ICapacity { - value: string; - unit: string; -} - export interface IErasureCodeCalc { error: number; maxEC: string; @@ -421,31 +30,6 @@ export interface IErasureCodeCalc { storageFactors: IStorageFactors[]; } -export interface LogSearchConfiguration { - storageClass?: string; - storageSize?: number; - image: string; - postgres_image: string; - postgres_init_image: string; - securityContext?: ISecurityContext; - postgres_securityContext?: ISecurityContext; -} - -export interface PrometheusConfiguration { - storageClass?: string; - storageSize?: number; - image: string; - sidecar_image: string; - init_image: string; - securityContext?: ISecurityContext; -} - -export interface AffinityConfiguration { - affinityType: "default" | "nodeSelector" | "none"; - nodeSelectorLabels?: ILabelKeyPair[]; - withPodAntiAffinity?: boolean; -} - export interface ErrorResponseHandler { errorMessage: string; detailedError: string; diff --git a/portal-ui/src/common/utils.ts b/portal-ui/src/common/utils.ts index 183d8628c..a253cf108 100644 --- a/portal-ui/src/common/utils.ts +++ b/portal-ui/src/common/utils.ts @@ -15,22 +15,10 @@ // along with this program. If not, see . import storage from "local-storage-fallback"; -import { - IBytesCalc, - ICapacity, - IErasureCodeCalc, - IStorageDistribution, - IStorageFactors, -} from "./types"; -import { IPool } from "../screens/Console/Tenants/ListTenants/types"; -import { - IMkEnvs, - IntegrationConfiguration, - mkPanelConfigurations, -} from "../screens/Console/Tenants/AddTenant/Steps/TenantResources/utils"; +import { IBytesCalc, IErasureCodeCalc, IStorageFactors } from "./types"; + import get from "lodash/get"; -const minStReq = 1073741824; // Minimal Space required for MinIO const minMemReq = 2147483648; // Minimal Memory required for MinIO in bytes export const units = [ @@ -228,204 +216,6 @@ export const setMemoryResource = ( }; }; -export const calculateDistribution = ( - capacityToUse: ICapacity, - forcedNodes: number = 0, - limitSize: number = 0, - drivesPerServer: number = 0, - marketplaceIntegration?: IMkEnvs, - selectedStorageType?: string -): IStorageDistribution => { - const requestedSizeBytes = getBytes( - capacityToUse.value, - capacityToUse.unit, - true - ); - - if (parseInt(requestedSizeBytes, 10) < minStReq) { - return { - error: "The pool size must be greater than 1Gi", - nodes: 0, - persistentVolumes: 0, - disks: 0, - pvSize: 0, - }; - } - - if (drivesPerServer <= 0) { - return { - error: "Number of drives must be at least 1", - nodes: 0, - persistentVolumes: 0, - disks: 0, - pvSize: 0, - }; - } - - let numberOfNodes = calculateStorage( - requestedSizeBytes, - forcedNodes, - limitSize, - drivesPerServer, - marketplaceIntegration, - selectedStorageType - ); - - return numberOfNodes; -}; - -const calculateStorage = ( - requestedBytes: string, - forcedNodes: number, - limitSize: number, - drivesPerServer: number, - marketplaceIntegration?: IMkEnvs, - selectedStorageType?: string -): IStorageDistribution => { - // Size validation - const intReqBytes = parseInt(requestedBytes, 10); - const maxDiskSize = minStReq * 256; // 256 GiB - - // We get the distribution - return structureCalc( - forcedNodes, - intReqBytes, - maxDiskSize, - limitSize, - drivesPerServer, - marketplaceIntegration, - selectedStorageType - ); -}; - -const structureCalc = ( - nodes: number, - desiredCapacity: number, - maxDiskSize: number, - maxClusterSize: number, - disksPerNode: number = 0, - marketplaceIntegration?: IMkEnvs, - selectedStorageType?: string -): IStorageDistribution => { - if ( - isNaN(nodes) || - isNaN(desiredCapacity) || - isNaN(maxDiskSize) || - isNaN(maxClusterSize) - ) { - return { - error: "Some provided data is invalid, please try again.", - nodes: 0, - persistentVolumes: 0, - disks: 0, - pvSize: 0, - }; // Invalid Data - } - - let persistentVolumeSize = 0; - let numberPersistentVolumes = 0; - let volumesPerServer = 0; - - if (disksPerNode === 0) { - persistentVolumeSize = Math.floor( - Math.min(desiredCapacity / Math.max(4, nodes), maxDiskSize) - ); // pVS = min((desiredCapacity / max(4 | nodes)) | maxDiskSize) - - numberPersistentVolumes = desiredCapacity / persistentVolumeSize; // nPV = dC / pVS - volumesPerServer = numberPersistentVolumes / nodes; // vPS = nPV / n - } - - if (disksPerNode) { - volumesPerServer = disksPerNode; - numberPersistentVolumes = volumesPerServer * nodes; - persistentVolumeSize = Math.floor( - desiredCapacity / numberPersistentVolumes - ); - } - - // Volumes are not exact, we force the volumes number & minimize the volume size - if (volumesPerServer % 1 > 0) { - volumesPerServer = Math.ceil(volumesPerServer); // Increment of volumes per server - numberPersistentVolumes = volumesPerServer * nodes; // nPV = vPS * n - persistentVolumeSize = Math.floor( - desiredCapacity / numberPersistentVolumes - ); // pVS = dC / nPV - - const limitSize = persistentVolumeSize * volumesPerServer * nodes; // lS = pVS * vPS * n - - if (limitSize > maxClusterSize) { - return { - error: "We were not able to allocate this server.", - nodes: 0, - persistentVolumes: 0, - disks: 0, - pvSize: 0, - }; // Cannot allocate this server - } - } - - if (persistentVolumeSize < minStReq) { - return { - error: - "Disk Size with this combination would be less than 1Gi, please try another combination", - nodes: 0, - persistentVolumes: 0, - disks: 0, - pvSize: 0, - }; // Cannot allocate this volume size - } - // validate for integrations - if (marketplaceIntegration !== undefined) { - const setConfigs = mkPanelConfigurations[marketplaceIntegration]; - const keyCount = Object.keys(setConfigs).length; - - //Configuration is filled - if (keyCount > 0) { - const configs: IntegrationConfiguration[] = get( - setConfigs, - "configurations", - [] - ); - const mainSelection = configs.find( - (item) => item.typeSelection === selectedStorageType - ); - - if (mainSelection !== undefined && mainSelection.minimumVolumeSize) { - const minimumPvSize = getBytesNumber( - mainSelection.minimumVolumeSize?.driveSize, - mainSelection.minimumVolumeSize?.sizeUnit, - true - ); - const storageTypeLabel = setConfigs.variantSelectorValues!.find( - (item) => item.value === selectedStorageType - ); - - if (persistentVolumeSize < minimumPvSize) { - return { - error: `For the ${ - storageTypeLabel!.label - } storage type the mininum volume size is ${ - mainSelection.minimumVolumeSize.driveSize - }${mainSelection.minimumVolumeSize.sizeUnit}`, - nodes: 0, - persistentVolumes: 0, - disks: 0, - pvSize: 0, - }; - } - } - } - } - - return { - error: "", - nodes, - persistentVolumes: numberPersistentVolumes, - disks: volumesPerServer, - pvSize: persistentVolumeSize, - }; -}; - // Erasure Code Parity Calc export const erasureCodeCalc = ( parityValidValues: string[], @@ -487,13 +277,6 @@ export const erasureCodeCalc = ( }; }; -// Pool Name Generator -export const generatePoolName = (pools: IPool[]) => { - const poolCounter = pools.length; - - return `pool-${poolCounter}`; -}; - // seconds / minutes /hours / Days / Years calculator export const niceDays = (secondsValue: string, timeVariant: string = "s") => { let seconds = parseFloat(secondsValue); @@ -917,3 +700,15 @@ export const MinIOEnvironmentVariables = [ "MINIO_STORAGE_CLASS_RRS", "MINIO_STORAGE_CLASS_STANDARD", ]; + +// Generates a valid access/secret key string +export const getRandomString = function (length = 16): string { + let retval = ""; + let legalcharacters = + "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + for (let i = 0; i < length; i++) { + retval += + legalcharacters[Math.floor(Math.random() * legalcharacters.length)]; + } + return retval; +}; diff --git a/portal-ui/src/screens/Console/Account/AddServiceAccountScreen.tsx b/portal-ui/src/screens/Console/Account/AddServiceAccountScreen.tsx index cc90b0ce1..4eec719b2 100644 --- a/portal-ui/src/screens/Console/Account/AddServiceAccountScreen.tsx +++ b/portal-ui/src/screens/Console/Account/AddServiceAccountScreen.tsx @@ -47,12 +47,12 @@ import api from "../../../../src/common/api"; import CredentialsPrompt from "../Common/CredentialsPrompt/CredentialsPrompt"; import SectionTitle from "../Common/SectionTitle"; -import { getRandomString } from "../../../screens/Console/Tenants/utils"; import PanelTitle from "../Common/PanelTitle/PanelTitle"; import { setErrorSnackMessage } from "../../../systemSlice"; import { useAppDispatch } from "../../../store"; import PageHeaderWrapper from "../Common/PageHeaderWrapper/PageHeaderWrapper"; +import { getRandomString } from "../../../common/utils"; interface IAddServiceAccountProps { classes: any; diff --git a/portal-ui/src/screens/Console/CommandBar.tsx b/portal-ui/src/screens/Console/CommandBar.tsx index 937130635..1788a2bd0 100644 --- a/portal-ui/src/screens/Console/CommandBar.tsx +++ b/portal-ui/src/screens/Console/CommandBar.tsx @@ -39,7 +39,6 @@ import { useSelector } from "react-redux"; import useApi from "./Common/Hooks/useApi"; import { Bucket, BucketList } from "./Buckets/types"; import { selFeatures } from "./consoleSlice"; -import { selDirectPVMode, selOpMode } from "../../systemSlice"; const useStyles = makeStyles((theme: Theme) => ({ resultItem: { @@ -127,8 +126,6 @@ const KBarStateChangeMonitor = ({ }; const CommandBar = () => { - const operatorMode = useSelector(selOpMode); - const directPVMode = useSelector(selDirectPVMode); const features = useSelector(selFeatures); const navigate = useNavigate(); @@ -148,13 +145,11 @@ const CommandBar = () => { const initialActions: Action[] = routesAsKbarActions( features, - operatorMode, - directPVMode, buckets, navigate ); - useRegisterActions(initialActions, [operatorMode, buckets, features]); + useRegisterActions(initialActions, [buckets, features]); //fetch buckets everytime the kbar is shown so that new buckets created elsewhere , within first page is also shown diff --git a/portal-ui/src/screens/Console/Common/TLSCertificate/TLSCertificate.tsx b/portal-ui/src/screens/Console/Common/TLSCertificate/TLSCertificate.tsx deleted file mode 100644 index 48dd998c6..000000000 --- a/portal-ui/src/screens/Console/Common/TLSCertificate/TLSCertificate.tsx +++ /dev/null @@ -1,211 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2022 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -import React from "react"; -import { DateTime, Duration } from "luxon"; -import { Theme } from "@mui/material/styles"; -import createStyles from "@mui/styles/createStyles"; -import withStyles from "@mui/styles/withStyles"; -import { ICertificateInfo } from "../../Tenants/types"; -import LanguageIcon from "@mui/icons-material/Language"; -import Chip from "@mui/material/Chip"; -import { - Box, - Container, - Divider, - Grid, - List, - ListItem, - ListItemAvatar, - ListItemText, - Typography, -} from "@mui/material"; -import EventBusyIcon from "@mui/icons-material/EventBusy"; -import AccessTimeIcon from "@mui/icons-material/AccessTime"; -import { CertificateIcon } from "mds"; - -const styles = (theme: Theme) => - createStyles({ - certificateIcon: { - float: "left", - paddingTop: "5px !important", - paddingRight: "10px !important", - }, - certificateInfo: { float: "right" }, - certificateWrapper: { - height: "auto", - margin: 5, - border: "1px solid #E2E2E2", - userSelect: "text", - borderRadius: 4, - "& h6": { - fontWeight: "bold", - }, - "& div": { - padding: 0, - }, - }, - certificateExpiry: { - color: "#616161", - display: "flex", - alignItems: "center", - flexWrap: "wrap", - marginBottom: 5, - "& .label": { - fontWeight: "bold", - }, - }, - certificateDomains: { - color: "#616161", - "& .label": { - fontWeight: "bold", - }, - }, - certificatesList: { - border: "1px solid #E2E2E2", - borderRadius: 4, - color: "#616161", - textTransform: "lowercase", - overflowY: "scroll", - maxHeight: 145, - marginBottom: 10, - }, - certificatesListItem: { - padding: "0px 16px", - borderBottom: "1px solid #E2E2E2", - "& div": { - minWidth: 0, - }, - "& svg": { - fontSize: 12, - marginRight: 10, - opacity: 0.5, - }, - "& span": { - fontSize: 12, - }, - }, - certificateExpiring: { - color: "orange", - "& .label": { - fontWeight: "bold", - }, - }, - certificateExpired: { - color: "red", - "& .label": { - fontWeight: "bold", - }, - }, - }); - -interface ITLSCertificate { - classes: any; - certificateInfo: ICertificateInfo; - onDelete: any; -} - -const TLSCertificate = ({ - classes, - certificateInfo, - onDelete = () => {}, -}: ITLSCertificate) => { - const certificates = certificateInfo.domains || []; - - const expiry = DateTime.fromISO(certificateInfo.expiry); - const now = DateTime.utc(); - // Expose error on Tenant if certificate is near expiration or expired - let daysToExpiry: number = 0; - let daysToExpiryHuman: string = ""; - let certificateExpiration: string = ""; - if (expiry) { - let durationToExpiry = expiry.diff(now); - daysToExpiry = durationToExpiry.as("days"); - daysToExpiryHuman = durationToExpiry - .minus(Duration.fromObject({ days: 1 })) - .shiftTo("days") - .toHuman({ listStyle: "long", maximumFractionDigits: 0 }); - if (daysToExpiry >= 10 && daysToExpiry < 30) { - certificateExpiration = classes.certificateExpiring; - } - if (daysToExpiry < 10) { - certificateExpiration = classes.certificateExpired; - if (daysToExpiry < 2) { - daysToExpiryHuman = durationToExpiry - .minus(Duration.fromObject({ minutes: 1 })) - .shiftTo("hours", "minutes") - .toHuman({ listStyle: "long", maximumFractionDigits: 0 }); - if (durationToExpiry.as("minutes") <= 1) { - daysToExpiryHuman = "EXPIRED"; - } - } - } - } - - return ( - - - - - - - {certificateInfo.name} - - - -   - Expiry:  - {expiry.toFormat("yyyy/MM/dd")} - - - -   - Expires in:  - {daysToExpiryHuman} - - -
- - {`${certificates.length} Domain (s):`} - - - {certificates.map((dom, index) => ( - - - - - - - ))} - -
- - } - onDelete={onDelete} - /> - ); -}; - -export default withStyles(styles)(TLSCertificate); diff --git a/portal-ui/src/screens/Console/Common/TolerationSelector/TolerationSelector.tsx b/portal-ui/src/screens/Console/Common/TolerationSelector/TolerationSelector.tsx deleted file mode 100644 index 975108cc8..000000000 --- a/portal-ui/src/screens/Console/Common/TolerationSelector/TolerationSelector.tsx +++ /dev/null @@ -1,222 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2022 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -import React from "react"; -import { - ITolerationEffect, - ITolerationOperator, -} from "../../../../common/types"; -import SelectWrapper, { - selectorTypes, -} from "../FormComponents/SelectWrapper/SelectWrapper"; -import { Grid, SelectChangeEvent } from "@mui/material"; -import InputBoxWrapper from "../FormComponents/InputBoxWrapper/InputBoxWrapper"; -import InputUnitMenu from "../FormComponents/InputUnitMenu/InputUnitMenu"; -import withStyles from "@mui/styles/withStyles"; -import { Theme } from "@mui/material/styles"; -import createStyles from "@mui/styles/createStyles"; - -interface ITolerationSelector { - effect: ITolerationEffect; - onEffectChange: (value: ITolerationEffect) => void; - tolerationKey: string; - onTolerationKeyChange: (value: string) => void; - operator: ITolerationOperator; - onOperatorChange: (value: ITolerationOperator) => void; - value?: string; - onValueChange: (value: string) => void; - tolerationSeconds?: number; - onSecondsChange: (value: number) => void; - index: number; - classes: any; -} - -const styles = (theme: Theme) => - createStyles({ - labelsStyle: { - fontSize: 18, - fontWeight: "bold", - color: "#AEAEAE", - display: "flex", - alignItems: "center", - justifyContent: "center", - maxWidth: 45, - marginRight: 10, - }, - fieldsetStyle: { - border: "1px solid #EAEAEA", - borderRadius: 2, - padding: 10, - marginBottom: 15, - }, - firstLevel: { - marginBottom: 10, - }, - fieldContainer: { - marginRight: 10, - }, - legendStyle: { - fontSize: 12, - color: "#696969", - fontWeight: "bold", - }, - }); - -const TolerationSelector = ({ - effect, - onEffectChange, - tolerationKey, - onTolerationKeyChange, - operator, - onOperatorChange, - value, - onValueChange, - tolerationSeconds, - onSecondsChange, - index, - classes, -}: ITolerationSelector) => { - const operatorOptions: selectorTypes[] = []; - const effectOptions: selectorTypes[] = []; - - for (let operator in ITolerationOperator) { - operatorOptions.push({ - value: operator, - label: operator, - }); - } - - for (let effect in ITolerationEffect) { - effectOptions.push({ - value: effect, - label: effect, - }); - } - - return ( - -
- Toleration {index + 1} - - - - If - - - { - onTolerationKeyChange(e.target.value); - }} - index={index} - placeholder={"Toleration Key"} - /> - - {ITolerationOperator[operator] === ITolerationOperator.Equal && ( - - is - - )} - - ) => { - onOperatorChange( - ITolerationOperator[e.target.value as ITolerationOperator] - ); - }} - id={`operator-${index}`} - name="operator" - label={""} - value={ITolerationOperator[operator]} - options={operatorOptions} - /> - - {ITolerationOperator[operator] === ITolerationOperator.Equal && ( - - to - - )} - {ITolerationOperator[operator] === ITolerationOperator.Equal && ( - - { - onValueChange(e.target.value); - }} - index={index} - placeholder={"Toleration Value"} - /> - - )} - - - - then - - - ) => { - onEffectChange( - ITolerationEffect[e.target.value as ITolerationEffect] - ); - }} - id={`effects-${index}`} - name="effects" - label={""} - value={ITolerationEffect[effect]} - options={effectOptions} - /> - - - after - - - { - if (e.target.validity.valid) { - onSecondsChange(parseInt(e.target.value)); - } - }} - index={index} - pattern={"[0-9]*"} - overlayObject={ - - } - /> - - - -
-
- ); -}; - -export default withStyles(styles)(TolerationSelector); diff --git a/portal-ui/src/screens/Console/Common/UsageBarWrapper/StackRow.tsx b/portal-ui/src/screens/Console/Common/UsageBarWrapper/StackRow.tsx deleted file mode 100644 index 285ec6589..000000000 --- a/portal-ui/src/screens/Console/Common/UsageBarWrapper/StackRow.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import React from "react"; -import { Stack } from "@mui/material"; - -const StackRow = ({ - children = null, - ...restProps -}: { - children?: any; - [x: string]: any; -}) => { - return ( - - {children} - - ); -}; -export default StackRow; diff --git a/portal-ui/src/screens/Console/Common/UsageBarWrapper/SummaryUsageBar.tsx b/portal-ui/src/screens/Console/Common/UsageBarWrapper/SummaryUsageBar.tsx deleted file mode 100644 index 14fbabb86..000000000 --- a/portal-ui/src/screens/Console/Common/UsageBarWrapper/SummaryUsageBar.tsx +++ /dev/null @@ -1,189 +0,0 @@ -import React, { Fragment } from "react"; -import { Theme } from "@mui/material/styles"; -import { LinearProgress, Stack } from "@mui/material"; -import createStyles from "@mui/styles/createStyles"; -import withStyles from "@mui/styles/withStyles"; -import Grid from "@mui/material/Grid"; -import { - CapacityValues, - ITenant, - ValueUnit, -} from "../../Tenants/ListTenants/types"; -import { CircleIcon, Loader } from "mds"; -import { niceBytes, niceBytesInt } from "../../../../common/utils"; -import TenantCapacity from "../../Tenants/ListTenants/TenantCapacity"; -import ErrorBlock from "../../../shared/ErrorBlock"; -import LabelValuePair from "./LabelValuePair"; - -interface ISummaryUsageBar { - tenant: ITenant; - label: string; - error: string; - loading: boolean; - classes: any; - labels?: boolean; - healthStatus?: string; -} - -const styles = (theme: Theme) => - createStyles({ - centerItem: { - textAlign: "center", - }, - }); - -export const BorderLinearProgress = withStyles((theme) => ({ - root: { - height: 10, - borderRadius: 5, - }, - colorPrimary: { - backgroundColor: "#F4F4F4", - }, - bar: { - borderRadius: 5, - backgroundColor: "#081C42", - }, - padChart: { - padding: "5px", - }, -}))(LinearProgress); - -const SummaryUsageBar = ({ - classes, - tenant, - healthStatus, - loading, - error, -}: ISummaryUsageBar) => { - let raw: ValueUnit = { value: "n/a", unit: "" }; - let capacity: ValueUnit = { value: "n/a", unit: "" }; - let used: ValueUnit = { value: "n/a", unit: "" }; - let localUse: ValueUnit = { value: "n/a", unit: "" }; - let tieredUse: ValueUnit = { value: "n/a", unit: "" }; - - if (tenant.status?.usage?.raw) { - const b = niceBytes(`${tenant.status.usage.raw}`, true); - const parts = b.split(" "); - raw.value = parts[0]; - raw.unit = parts[1]; - } - if (tenant.status?.usage?.capacity) { - const b = niceBytes(`${tenant.status.usage.capacity}`, true); - const parts = b.split(" "); - capacity.value = parts[0]; - capacity.unit = parts[1]; - } - if (tenant.status?.usage?.capacity_usage) { - const b = niceBytesInt(tenant.status.usage.capacity_usage, true); - const parts = b.split(" "); - used.value = parts[0]; - used.unit = parts[1]; - } - - let spaceVariants: CapacityValues[] = []; - if (!tenant.tiers || tenant.tiers.length === 0) { - spaceVariants = [ - { value: tenant.status?.usage?.capacity_usage || 0, variant: "STANDARD" }, - ]; - } else { - spaceVariants = tenant.tiers.map((itemTenant) => { - return { value: itemTenant.size, variant: itemTenant.name }; - }); - let internalUsage = tenant.tiers - .filter((itemTenant) => { - return itemTenant.type === "internal"; - }) - .reduce((sum, itemTenant) => sum + itemTenant.size, 0); - let tieredUsage = tenant.tiers - .filter((itemTenant) => { - return itemTenant.type !== "internal"; - }) - .reduce((sum, itemTenant) => sum + itemTenant.size, 0); - - const t = niceBytesInt(tieredUsage, true); - const parts = t.split(" "); - tieredUse.value = parts[0]; - tieredUse.unit = parts[1]; - - const is = niceBytesInt(internalUsage, true); - const partsInternal = is.split(" "); - localUse.value = partsInternal[0]; - localUse.unit = partsInternal[1]; - } - - const renderComponent = () => { - if (!loading) { - return error !== "" ? ( - - ) : ( - - - - {(!tenant.tiers || tenant.tiers.length === 0) && ( - - - - )} - {tenant.tiers && tenant.tiers.length > 0 && ( - - - - - )} - {healthStatus && ( - - - - } - /> - )} - - - ); - } - - return null; - }; - - return ( - - {loading && ( -
- - - -
- )} - {renderComponent()} -
- ); -}; - -export default withStyles(styles)(SummaryUsageBar); diff --git a/portal-ui/src/screens/Console/Console.tsx b/portal-ui/src/screens/Console/Console.tsx index 70443d9e3..8da414f68 100644 --- a/portal-ui/src/screens/Console/Console.tsx +++ b/portal-ui/src/screens/Console/Console.tsx @@ -47,13 +47,10 @@ import { import { hasPermission } from "../../common/SecureComponent"; import { IRouteRule } from "./Menu/types"; import LoadingComponent from "../../common/LoadingComponent"; -import EditPool from "./Tenants/TenantDetails/Pools/EditPool/EditPool"; import ComponentsScreen from "./Common/ComponentsScreen"; import { menuOpen, - selDirectPVMode, selDistSet, - selOpMode, serverIsLoading, setServerNeedsRestart, setSnackBarMessage, @@ -64,10 +61,6 @@ const Trace = React.lazy(() => import("./Trace/Trace")); const Heal = React.lazy(() => import("./Heal/Heal")); const Watch = React.lazy(() => import("./Watch/Watch")); const HealthInfo = React.lazy(() => import("./HealthInfo/HealthInfo")); -const Hop = React.lazy(() => import("./Tenants/TenantDetails/hop/Hop")); -const RegisterOperator = React.lazy(() => import("./Support/RegisterOperator")); - -const AddTenant = React.lazy(() => import("./Tenants/AddTenant/AddTenant")); const EventDestinations = React.lazy( () => import("./EventDestinations/EventDestinations") @@ -88,9 +81,6 @@ const TierTypeSelector = React.lazy( const AddTierConfiguration = React.lazy( () => import("./Configurations/TiersConfiguration/AddTierConfiguration") ); -const ListTenants = React.lazy( - () => import("./Tenants/ListTenants/ListTenants") -); const ErrorLogs = React.lazy(() => import("./Logs/ErrorLogs/ErrorLogs")); const LogsSearchMain = React.lazy( @@ -142,17 +132,11 @@ const IDPOpenIDConfigurationDetails = React.lazy( () => import("./IDP/IDPOpenIDConfigurationDetails") ); -const TenantDetails = React.lazy( - () => import("./Tenants/TenantDetails/TenantDetails") -); const License = React.lazy(() => import("./License/License")); -const Marketplace = React.lazy(() => import("./Marketplace/Marketplace")); const ConfigurationOptions = React.lazy( () => import("./Configurations/ConfigurationPanels/ConfigurationOptions") ); -const AddPool = React.lazy( - () => import("./Tenants/TenantDetails/Pools/AddPool/AddPool") -); + const AddGroupScreen = React.lazy(() => import("./Groups/AddGroupScreen")); const SiteReplication = React.lazy( () => import("./Configurations/SiteReplication/SiteReplication") @@ -165,12 +149,6 @@ const AddReplicationSites = React.lazy( () => import("./Configurations/SiteReplication/AddReplicationSites") ); -const StoragePVCs = React.lazy(() => import("./Storage/StoragePVCs")); - -const DirectPVDrives = React.lazy(() => import("./DirectPV/DirectPVDrives")); - -const DirectPVVolumes = React.lazy(() => import("./DirectPV/DirectPVVolumes")); - const KMSRoutes = React.lazy(() => import("./KMS/KMSRoutes")); const styles = (theme: Theme) => @@ -219,8 +197,6 @@ const Console = ({ classes }: IConsoleProps) => { const session = useSelector(selSession); const features = useSelector(selFeatures); const distributedSetup = useSelector(selDistSet); - const operatorMode = useSelector(selOpMode); - const directPVMode = useSelector(selDirectPVMode); const snackBarMessage = useSelector( (state: AppState) => state.system.snackBar ); @@ -480,85 +456,8 @@ const Console = ({ classes }: IConsoleProps) => { }, ]; - const operatorConsoleRoutes: IRouteRule[] = [ - { - component: ListTenants, - path: IAM_PAGES.TENANTS, - forceDisplay: true, - }, - { - component: AddTenant, - path: IAM_PAGES.TENANTS_ADD, - forceDisplay: true, - }, - { - component: TenantDetails, - path: IAM_PAGES.NAMESPACE_TENANT, - forceDisplay: true, - }, - { - component: Hop, - path: IAM_PAGES.NAMESPACE_TENANT_HOP, - forceDisplay: true, - }, - { - component: AddPool, - path: IAM_PAGES.NAMESPACE_TENANT_POOLS_ADD, - forceDisplay: true, - }, - { - component: EditPool, - path: IAM_PAGES.NAMESPACE_TENANT_POOLS_EDIT, - forceDisplay: true, - }, - { - component: License, - path: IAM_PAGES.LICENSE, - forceDisplay: true, - }, - { - component: RegisterOperator, - path: IAM_PAGES.REGISTER_SUPPORT, - forceDisplay: true, - }, - { - component: Marketplace, - path: IAM_PAGES.OPERATOR_MARKETPLACE, - forceDisplay: true, - }, - ]; - - const directPVRoutes: IRouteRule[] = [ - { - component: StoragePVCs, - path: IAM_PAGES.DIRECTPV_STORAGE, - forceDisplay: true, - }, - { - component: DirectPVDrives, - path: IAM_PAGES.DIRECTPV_DRIVES, - forceDisplay: true, - }, - { - component: DirectPVVolumes, - path: IAM_PAGES.DIRECTPV_VOLUMES, - forceDisplay: true, - }, - { - component: License, - path: IAM_PAGES.LICENSE, - forceDisplay: true, - }, - ]; - let routes = consoleAdminRoutes; - if (directPVMode) { - routes = directPVRoutes; - } else if (operatorMode) { - routes = operatorConsoleRoutes; - } - const allowedRoutes = routes.filter((route: any) => obOnly ? route.path.includes("buckets") diff --git a/portal-ui/src/screens/Console/DirectPV/DirectPVDrives.tsx b/portal-ui/src/screens/Console/DirectPV/DirectPVDrives.tsx deleted file mode 100644 index b4f1717e8..000000000 --- a/portal-ui/src/screens/Console/DirectPV/DirectPVDrives.tsx +++ /dev/null @@ -1,346 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2022 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -import React, { Fragment, useEffect, useState } from "react"; -import { Theme } from "@mui/material/styles"; -import { - AddIcon, - Button, - HelpBox, - RefreshIcon, - SearchIcon, - StorageIcon, -} from "mds"; -import createStyles from "@mui/styles/createStyles"; -import withStyles from "@mui/styles/withStyles"; -import { Grid, InputAdornment, TextField } from "@mui/material"; -import get from "lodash/get"; -import GroupIcon from "@mui/icons-material/Group"; -import { - actionsTray, - containerForHeader, - searchField, -} from "../Common/FormComponents/common/styleLibrary"; -import { - IDirectPVDrives, - IDirectPVFormatResItem, - IDrivesResponse, -} from "./types"; -import { niceBytes } from "../../../common/utils"; -import { ErrorResponseHandler } from "../../../common/types"; -import api from "../../../common/api"; -import TableWrapper from "../Common/TableWrapper/TableWrapper"; - -import withSuspense from "../Common/Components/withSuspense"; -import PageLayout from "../Common/Layout/PageLayout"; -import PageHeaderWrapper from "../Common/PageHeaderWrapper/PageHeaderWrapper"; - -const FormatDrives = withSuspense(React.lazy(() => import("./FormatDrives"))); -const FormatErrorsResult = withSuspense( - React.lazy(() => import("./FormatErrorsResult")) -); - -interface IDirectPVMain { - classes: any; -} - -const styles = (theme: Theme) => - createStyles({ - tableWrapper: { - height: "calc(100vh - 275px)", - }, - linkItem: { - display: "default", - color: theme.palette.info.main, - textDecoration: "none", - "&:hover": { - textDecoration: "underline", - color: "#000", - }, - }, - ...actionsTray, - ...searchField, - ...containerForHeader, - }); - -const DirectPVMain = ({ classes }: IDirectPVMain) => { - const [records, setRecords] = useState([]); - const [filter, setFilter] = useState(""); - const [checkedDrives, setCheckedDrives] = useState([]); - const [loading, setLoading] = useState(true); - const [formatOpen, setFormatOpen] = useState(false); - const [formatAll, setFormatAll] = useState(false); - const [formatErrorsResult, setFormatErrorsResult] = useState< - IDirectPVFormatResItem[] - >([]); - const [formatErrorsOpen, setFormatErrorsOpen] = useState(false); - const [drivesToFormat, setDrivesToFormat] = useState([]); - const [notAvailable, setNotAvailable] = useState(true); - - useEffect(() => { - if (loading) { - api - .invoke("GET", "/api/v1/directpv/drives") - .then((res: IDrivesResponse) => { - let drives: IDirectPVDrives[] = get(res, "drives", []); - - if (!drives) { - drives = []; - } - - drives = drives.map((item) => { - const newItem = { ...item }; - newItem.joinName = `${newItem.node}:${newItem.drive}`; - - return newItem; - }); - - drives.sort((d1, d2) => { - if (d1.drive > d2.drive) { - return 1; - } - - if (d1.drive < d2.drive) { - return -1; - } - - return 0; - }); - - setRecords(drives); - setLoading(false); - setNotAvailable(false); - }) - .catch((err: ErrorResponseHandler) => { - setLoading(false); - setNotAvailable(true); - }); - } - }, [loading, notAvailable]); - - const formatAllDrives = () => { - const allDrives = records.map((item) => { - return `${item.node}:${item.drive}`; - }); - setFormatAll(true); - setDrivesToFormat(allDrives); - setFormatOpen(true); - }; - - const formatSingleUnit = (driveID: string) => { - const selectedUnit = [driveID]; - setDrivesToFormat(selectedUnit); - setFormatAll(false); - setFormatOpen(true); - }; - - const formatSelectedDrives = () => { - if (checkedDrives.length > 0) { - setDrivesToFormat(checkedDrives); - setFormatAll(false); - setFormatOpen(true); - } - }; - - const selectionChanged = (e: React.ChangeEvent) => { - const targetD = e.target; - const value = targetD.value; - const checked = targetD.checked; - - let elements: string[] = [...checkedDrives]; // We clone the checkedDrives array - - if (checked) { - // If the user has checked this field we need to push this to checkedDrivesList - elements.push(value); - } else { - // User has unchecked this field, we need to remove it from the list - elements = elements.filter((element) => element !== value); - } - - setCheckedDrives(elements); - - return elements; - }; - - const closeFormatModal = ( - refresh: boolean, - errorsList: IDirectPVFormatResItem[] - ) => { - setFormatOpen(false); - if (refresh) { - // Errors are present, we trigger the modal box to show these changes. - if (errorsList && errorsList.length > 0) { - setFormatErrorsResult(errorsList); - setFormatErrorsOpen(true); - } - setLoading(true); - setCheckedDrives([]); - } - }; - - const tableActions = [ - { - type: "format", - onClick: formatSingleUnit, - sendOnlyId: true, - }, - ]; - - const filteredRecords: IDirectPVDrives[] = records.filter((elementItem) => - elementItem.drive.includes(filter) - ); - - return ( - - {formatOpen && ( - - )} - - {formatErrorsOpen && ( - { - setFormatErrorsOpen(false); - }} - /> - )} - - - - - - - ), - }} - onChange={(e) => { - setFilter(e.target.value); - }} - disabled={notAvailable} - variant="standard" - /> -